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

#ifndef _OFOSCMESSAGE_H
#define _OFOSCMESSAGE_H

#include "ofOscArg.h"
#include <vector>
#include <string>

class ofOscMessage
{
public:
	ofOscMessage();
	~ofOscMessage();
	ofOscMessage( const ofOscMessage& other ) { copy ( other ); }
	ofOscMessage& operator= ( const ofOscMessage& other ) { return copy( other ); }
	// for operator= and copy constructor
	ofOscMessage& copy( const ofOscMessage& other );
	
	/// return the address
	const char* getAddress() const { return address.c_str(); }
	
	/// return number of arguments
	int getNumArgs() const;
	/// return argument type code for argument # index
	ofOscArgType getArgType( int index ) const;
	/// return argument type name as string 
	/// - either "int", "float", or "string"
	const char* getArgTypeName( int index ) const;
	
	/// get the argument with the given index as an int, float, or string
	/// ensure that the type matches what you're requesting
	/// (eg for an int argument, getArgType(index)==OF_TYPE_INT32 
	/// or getArgTypeName(index)=="int32")
	int32_t getArgAsInt32( int index ) const;
	float getArgAsFloat( int index ) const;
	const char* getArgAsString( int index ) const;
	
	/// message construction
	void setAddress( const char* _address ) { address = _address; };
	void addIntArg( int32_t argument );
	void addFloatArg( float argument );
	void addStringArg( const char* argument );
	
private:
	
	std::string address;
	std::vector<ofOscArg*> args;
};

#endif
