#Constructor
OSCMessage( char * address );
The constructor must have the address of the message as an argument.

void empty();
empty frees all of the data contained in the message, but retains the address.

#Adding Data
OSCMessage& add ( int data );
OSCMessage& add ( double data );
OSCMessage& add ( float data );
OSCMessage& add ( char * data );
OSCMessage& add ( uint8_t * data , int len );

The add method is overloaded so that all the OSC data types can be added with the same method. It returns the OSCMessage so that the methods can be chained together.

Similarly, the set method takes a position and an OSC data type and replaces the data at that position.

OSCMessage & set (int position, any data type)

#Getting Data
int getInt(int position);
float getFloat(int position);
double getDouble(int position);
int getBlob (int position, uint8_t * buffer, int bufferSize );
void getString (int position, char * buffer, int bufferSize );

getBlob and getString take a buffer as an argument which is filled with the message data. getBlob returns the number of bytes added to the buffer, and getString puts the message's next string in the char buffer (null terminated).

To get the size of the data (in bytes), use:
int getDataLength(int position);

int getAddress(char * buffer, int offset = 0);
Fills the buffer with the message's address. Returns the length of the address. Optionally accepts an offset from which to fill the buffer.

char getType(int position)
The getType method returns the type of the data at that position as a char (i.e. int = 'i', float = 'f', etc.)

#Data Tests
bool isInt();
bool isFloat();
bool isDouble();
bool isBlob();
bool isString();

Test what the type of the next piece of data is.

#Input/Output
void send ( Print & printer );
Outputs the entire message to the printer.

void fill(uint8_t byte);
void fill(uint8_t * buffer, int bufferLength);

fill will fill the message with the bytes as they come in and parse the data as soon as it's valid. This method raises the 'INVALID_OSC' error until the message is fully filled.

#Matching
bool fullMatch(const char * pattern, int addressOffset = 0);
Returns true only if the OSCMessage's address is a full match of the pattern. Optionally takes a the address offset as an argument which is the starting position in the address to match from.

int match(const char * pattern, int addressOffset = 0);
Similar to fullMatch, but instead returns the number of address characters matched by the pattern. Returns 0 if there was no match or the match did not terminate at the end of the address or at a '/'.

bool dispatch (char * pattern, void (*callback)(OSCMessage&), int addressOffset = 0);
Calls the callback function if the address is a full match of the pattern. Returns true if the callback was invoked.

bool route(char * pattern, void (*callback)(OSCMessage&, int), int = 0);
Similar to dispatch, but allows for partial matches and the callback function takes an additional argument: an integer of the number of characters matched in the address.

#Attributes
int size();
Returns the number of data in the OSCMessage

int bytes();
Returns the total length of the message in bytes.

bool hasError();
OSCErrorCode getError();

Returns true if the OSCMessage or any of its data has raised one of these error flags. The errors are cleared when the message is emptied with empty. OSCMessages with any errors will not send.


typedef enum { OSC_OK = 0,
	BUFFER_FULL, INVALID_OSC, ALLOCFAILED, INDEX_OUT_OF_BOUNDS
} OSCErrorCode;