IMessageWithData Class Referenceabstract

A type of message that can contain different kinds of arbitrary dataA message that can contain different kinds of data. The intended usage is for the message to be exchanged between boxes. A message can hold four types of data: uint64, float64, CString and IMatrix. Each data item is accessed by its string identifier key using a getter/setter corresponding to the data type. The key is unique within the data type. More...

Inheritance diagram for IMessageWithData:
IMessage

Public Member Functions

Getters
virtual bool getValueUint64 (const CString &key, OpenViBE::uint64 &rValueOut) const =0
 Gets the integer value stored under this key. More...
 
virtual bool getValueFloat64 (const CString &key, OpenViBE::float64 &rValueOut) const =0
 Gets the float value stored under this key. More...
 
virtual bool getValueCString (const CString &key, const OpenViBE::CString **pValueOut) const =0
 Gets a pointer to the CString value stored under this key. More...
 
virtual bool getValueIMatrix (const CString &key, const OpenViBE::IMatrix **pOutMatrix) const =0
 Gets a pointer to the CMatrix value stored under this key. More...
 
Setters
virtual bool setValueUint64 (const CString &key, uint64 valueIn)=0
 Sets the message internal UInt64 value stored under this key. More...
 
virtual bool setValueFloat64 (const CString &key, float64 valueIn)=0
 Sets the message internal Float64 value stored under this key. More...
 
virtual bool setValueCString (const CString &key, const CString &valueIn)=0
 Sets the message internal CString value stored under this key. More...
 
virtual bool setValueIMatrix (const CString &key, const IMatrix &valueIn)=0
 Sets the message internal IMatrix value stored under this key. More...
 
Getters and iterators for keys
virtual const OpenViBE::CStringgetFirstCStringToken () const =0
 Get the first key of the CString container. More...
 
virtual const OpenViBE::CStringgetFirstUInt64Token () const =0
 Get the first key of the UInt64 container. More...
 
virtual const OpenViBE::CStringgetFirstFloat64Token () const =0
 Get the first key of the Float64 container. More...
 
virtual const OpenViBE::CStringgetFirstIMatrixToken () const =0
 Get the first key of the CMatrix container. More...
 
virtual const OpenViBE::CStringgetNextCStringToken (const OpenViBE::CString &previousToken) const =0
 Get the next key of the CString container. More...
 
virtual const OpenViBE::CStringgetNextUInt64Token (const OpenViBE::CString &previousToken) const =0
 Get the next key of the UInt64 container. More...
 
virtual const OpenViBE::CStringgetNextFloat64Token (const OpenViBE::CString &previousToken) const =0
 Get the next key of the Float64 container. More...
 
virtual const OpenViBE::CStringgetNextIMatrixToken (const OpenViBE::CString &previousToken) const =0
 Get the next key of the CMatrix container. More...
 
- Public Member Functions inherited from IMessage
virtual OpenViBE::CIdentifier getIdentifier (void) const =0
 Gets the message identifier. More...
 
virtual OpenViBE::uint64 getTime (void) const =0
 Gets the timestamp of the message. More...
 
virtual OpenViBE::boolean setIdentifier (const OpenViBE::CIdentifier &rIdentifier)=0
 Sets the message identifier for this message. More...
 
virtual OpenViBE::boolean setTime (const OpenViBE::uint64 ui64Time)=0
 Sets the message timestamp. More...
 

Detailed Description

A type of message that can contain different kinds of arbitrary data

A message that can contain different kinds of data. The intended usage is for the message to be exchanged between boxes. A message can hold four types of data: uint64, float64, CString and IMatrix. Each data item is accessed by its string identifier key using a getter/setter corresponding to the data type. The key is unique within the data type.

Author
Loic Mahe (Inria)
Date
2013-10-02 Although the IMessageWithData inherits IMessage, the parent class' identifier and timestamp fields are not automatically filled. For example, we are not timestamping the message on its creation. This is because the IMessageWithData is a type that was designed to be immediately processed anyway during the same kernel scheduler tick. So for most use-cases, the time stamp does not make sense. If needed (for example for debug purposes), the caller who fills the message can also stamp it or set it an identifier using the setters inherited from the parent class.

Member Function Documentation

virtual bool getValueUint64 ( const CString key,
OpenViBE::uint64 &  rValueOut 
) const
pure virtual

Gets the integer value stored under this key.

Parameters
key: a reference to the name of the key
rValueOut: the associated data. Unmodified in case of error.
Returns
true in case of success
false in case of error
virtual bool getValueFloat64 ( const CString key,
OpenViBE::float64 &  rValueOut 
) const
pure virtual

Gets the float value stored under this key.

Parameters
key: a reference to the name of the key
rValueOut: the associated data. Unmodified in case of error.
Returns
true in case of success
false in case of error
virtual bool getValueCString ( const CString key,
const OpenViBE::CString **  pValueOut 
) const
pure virtual

Gets a pointer to the CString value stored under this key.

Note
User should copy the content, the returned pointer will be invalid later.
Parameters
key: a reference to the name of the key
pValueOut: pointer to the associated data. NULL in case of error. Do not free.
Returns
true if fetched ok, false otherwise
virtual bool getValueIMatrix ( const CString key,
const OpenViBE::IMatrix **  pOutMatrix 
) const
pure virtual

Gets a pointer to the CMatrix value stored under this key.

Note
User should copy the content, the returned pointer will be invalid later.
Parameters
key: a reference to the name of the key
pValueOut: pointer to the associated data. NULL in case of error. Do not free.
Returns
true in case of success
false in case of error
virtual bool setValueUint64 ( const CString key,
uint64  valueIn 
)
pure virtual

Sets the message internal UInt64 value stored under this key.

Parameters
key: the name of the key
valueIn: the value to put into the message
Returns
true in case of success
false in case of error
virtual bool setValueFloat64 ( const CString key,
float64  valueIn 
)
pure virtual

Sets the message internal Float64 value stored under this key.

Parameters
key: the name of the key
valueIn: the value to put in the message
Returns
true in case of success
false in case of error
virtual bool setValueCString ( const CString key,
const CString valueIn 
)
pure virtual

Sets the message internal CString value stored under this key.

Note
The message will make an internal full copy of valueIn.
Parameters
key: the name of the key
valueIn: the value to put in the message
Returns
true in case of success
false in case of error
virtual bool setValueIMatrix ( const CString key,
const IMatrix valueIn 
)
pure virtual

Sets the message internal IMatrix value stored under this key.

Note
The message will make an internal full copy of valueIn.
Parameters
key: the name of the key
valueIn: the data to put in the message
Returns
true in case of success
false in case of error
virtual const OpenViBE::CString* getFirstCStringToken ( ) const
pure virtual

Get the first key of the CString container.

Returns
a pointer to the key in case of success
NULL in case of error or container is empty
virtual const OpenViBE::CString* getFirstUInt64Token ( ) const
pure virtual

Get the first key of the UInt64 container.

Returns
a pointer to the key in case of success
NULL in case of error or container is empty
virtual const OpenViBE::CString* getFirstFloat64Token ( ) const
pure virtual

Get the first key of the Float64 container.

Returns
a pointer to the key in case of success
NULL in case of error or container is empty
virtual const OpenViBE::CString* getFirstIMatrixToken ( ) const
pure virtual

Get the first key of the CMatrix container.

Returns
a pointer to the key in case of success
NULL in case of error or container is empty
virtual const OpenViBE::CString* getNextCStringToken ( const OpenViBE::CString previousToken) const
pure virtual

Get the next key of the CString container.

Parameters
previousToken: a reference to the previous key
Returns
a pointer to the key in case of success
NULL in case of error or if no more tokens are available
virtual const OpenViBE::CString* getNextUInt64Token ( const OpenViBE::CString previousToken) const
pure virtual

Get the next key of the UInt64 container.

Parameters
previousToken: a reference to the previous key
Returns
a pointer to the key in case of success
NULL in case of error or if no more tokens are available
virtual const OpenViBE::CString* getNextFloat64Token ( const OpenViBE::CString previousToken) const
pure virtual

Get the next key of the Float64 container.

Parameters
previousToken: a reference to the previous key
Returns
a pointer to the key in case of success
NULL in case of error or if no more tokens are available
virtual const OpenViBE::CString* getNextIMatrixToken ( const OpenViBE::CString previousToken) const
pure virtual

Get the next key of the CMatrix container.

Parameters
previousToken: a reference to the previous key
Returns
a pointer to the key in case of success
NULL in case of error or if no more tokens are available