NAP
OSCEvent Class Reference

#include <oscevent.h>

Public Types

using ArgumentConstIterator = utility::UniquePtrConstVectorWrapper< OSCArgumentList, OSCArgument * >
 

Public Member Functions

 OSCEvent ()=delete
 
 OSCEvent (const std::string &address)
 
 OSCEvent (const std::string &&address)
 
const std::string & getAddress () const
 
template<typename T , typename... Args>
OSCArgumentaddArgument (Args &&... args)
 
template<typename T , typename... Args>
OSCArgumentaddValue (Args &&... args)
 
OSCArgumentaddString (const std::string &string)
 
int getCount () const
 
const ArgumentConstIterator getArguments () const
 
const OSCArgumentgetArgument (int index) const
 
OSCArgumentgetArgument (int index)
 
std::size_t getSize () const
 
OSCArgumentoperator[] (std::size_t idx)
 
const OSCArgumentoperator[] (std::size_t idx) const
 
- Public Member Functions inherited from Event
virtual ~Event ()=default
 
 Event ()=default
 
 Event (Event &)=delete
 
Eventoperator= (const Event &)=delete
 

Detailed Description

A generic OSC event. An OSC event has an address and a set of arguments (values) associated with it. This event can be constructed by a client to be send over or evaluated when received. Use the array [] overload to access the individual osc arguments.

Inheritance diagram for OSCEvent:
[legend]
Collaboration diagram for OSCEvent:
[legend]

Member Typedef Documentation

◆ ArgumentConstIterator

Constructor & Destructor Documentation

◆ OSCEvent() [1/3]

OSCEvent ( )
delete

◆ OSCEvent() [2/3]

OSCEvent ( const std::string &  address)

OSCEvent constructor

Parameters
addressthe address associated with this osc event

◆ OSCEvent() [3/3]

OSCEvent ( const std::string &&  address)

OSCEvent constructor

Parameters
addressthe address associated with this osc event

Member Function Documentation

◆ addArgument()

OSCArgument * addArgument ( Args &&...  args)

Adds an OSCArgument to this event. The template type must be of type OSCBaseValue. The arguments are used to construct the OSCValue, for example:

addArgument<OSCFloat>(1.0f) 
addArgument<OSCString>("ola!")

the arguments that are used for constructing the specified OSCValue.

Returns
the newly created and added argument

◆ addString()

OSCArgument* addString ( const std::string &  string)

Adds an OSCArgument that holds a string. This is a utility function that wraps addArgument

Parameters
stringthe string to give to the argument
Returns
the newly created and added argument.

◆ addValue()

OSCArgument * addValue ( Args &&...  args)

Adds an OSCArgument to this event. The argument wraps an OSCValue of type T, for example:

addValue<float>(1.0f) -> adds an OSCValue<float> addValue<int>(1) -> adds an OSCValue<int>.

This is a utility function that wraps addArgument based on the given OSC value type. Note that only registered OSC value types are considered valid.

Parameters
argsthe value that is used to construct the OSCValue.
Returns
the newly created and added argument.

◆ getAddress()

const std::string& getAddress ( ) const
Returns
this event's OSC address

◆ getArgument() [1/2]

const OSCArgument* getArgument ( int  index) const
Returns
an argument based on index
Parameters
indexthe index of the argument, will throw an exception when out of bounds

◆ getArgument() [2/2]

OSCArgument* getArgument ( int  index)
Returns
an argument based on index
Parameters
indexthe index of the argument

◆ getArguments()

const ArgumentConstIterator getArguments ( ) const
Returns
the arguments of this osc event

◆ getCount()

int getCount ( ) const
Returns
the number of arguments associated with this event

◆ getSize()

std::size_t getSize ( ) const
Returns
the size of the osc event in bytes This includes the size of the arguments together with the name of this event

◆ operator[]() [1/2]

OSCArgument& operator[] ( std::size_t  idx)

Array [] subscript operator

Returns
the osc argument at index

◆ operator[]() [2/2]

const OSCArgument& operator[] ( std::size_t  idx) const

Array [] subscript operator

Returns
the osc argument at index