/*
 *  ofOscArg.h
 *  openFrameworks OSC addon
 *
 *  damian@frey.co.nz
 *
 */

#ifndef _OFOSCARG_H
#define _OFOSCARG_H

#include <ofConstants.h>
#include <string>

typedef enum _ofOscArgType
{
	OFOSC_TYPE_NONE = 0,
	OFOSC_TYPE_INT32 = 1,
	OFOSC_TYPE_FLOAT = 2,
	OFOSC_TYPE_STRING = 3,
	OFOSC_TYPE_BLOB = 4
} ofOscArgType;

/*

ofOscArg

base class for arguments

*/

class ofOscArg
{
public:
	ofOscArg() {};
	virtual ~ofOscArg() {};
	
	virtual ofOscArgType getType() { return OFOSC_TYPE_NONE; }
	virtual const char* getTypeName() { return "none"; }
	
private:
};


/*

subclasses for each possible argument type

*/

#if defined TARGET_WIN32 && defined _MSC_VER
// required because MSVC isn't ANSI-C compliant
typedef long int32_t;
#endif

class ofOscArgInt32 : public ofOscArg
{
public:
	ofOscArgInt32( int32_t _value ) { value = _value; }
	~ofOscArgInt32() {};
	
	/// return the type of this argument
	ofOscArgType getType() { return OFOSC_TYPE_INT32; }
	const char* getTypeName() { return "int32"; }
	
	/// return value
	int32_t get() const { return value; }
	/// set value
	void set( int32_t _value ) { value = _value; }
	
private:
	int32_t value;
};

class ofOscArgFloat : public ofOscArg
{
public:
	ofOscArgFloat( float _value ) { value = _value; }
	~ofOscArgFloat() {};
	
	/// return the type of this argument
	ofOscArgType getType() { return OFOSC_TYPE_FLOAT; }
	const char* getTypeName() { return "float"; }
	
	/// return value
	float get() const { return value; }
	/// set value
	void set( float _value ) { value = _value; }
	
private:
		float value;
};

class ofOscArgString : public ofOscArg
{
public:
	ofOscArgString( const char* _value ) { value = _value; }
	~ofOscArgString() {};
	
	/// return the type of this argument
	ofOscArgType getType() { return OFOSC_TYPE_STRING; }
	const char* getTypeName() { return "string"; }

	/// return value
	const char* get() const { return value.c_str(); }
	/// set value
	void set( const char* _value ) { value = _value; }
	
private:
	std::string value;
};

#endif
