iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages

Modules communicate with each other by passing Message objects, which can be any C++ type that derived from nrt::MessageBase and that implementa a serialize function.

Messages can be of three basic types:

Classes

class  nrt::AnyMessage
 Generic opaque message that can contain any message data. More...
 
class  nrt::MessageBase
 Base class for a message that can be passed from one Module to other(s) (via a Blackboard) More...
 
class  nrt::Message< T >
 Generic message template that contains one value. More...
 
class  nrt::MessageData< Field, Tail...>
 Generic message data template used in messages that contain multiple fields/values. More...
 
class  nrt::CompositeMessage< Fields >
 A composite message with multiple fields. More...
 
class  nrt::TriggerMessage
 An empty message used to trigger events. More...
 

Macros

#define NRT_DECLARE_MESSAGE(MessageClass)
 Macro to create a standard message. More...
 
#define NRT_DECLARE_MESSAGEFIELD(FieldName, Type, Description)
 Convenience macro to define a MessageField. More...
 
#define NRT_MESSAGEFIELD(x)
 Convenience macro to access a MessageField. More...
 

Functions

template<typename T >
std::unique_ptr< T > nrt::make_unique (T *const object)
 Wrap an std::unique_ptr around the given object pointer. More...
 
template<class Msg >
std::string const nrt::MessageType ()
 Free function to statically identify the message type and return it as string.
 
template<>
std::string const nrt::MessageType< void > ()
 Specialization for void messages.
 

Macro Definition Documentation

#define NRT_DECLARE_MESSAGE (   MessageClass)

Macro to create a standard message.

Declares a class for the given message, inherits from nrt::MessageBase, and inherits from nrt::MessageTypesCreator (which automatically declares commonly used message types dependent on the current message type).

Use this as follows:

{
public:
int x, y; // whatever data fields you want here
// Don't forget the serialization function
template <class Archive> inline void serialize(Archive & ar)
{
ar( x, y );
}
};

Definition at line 109 of file Message.H.

#define NRT_DECLARE_MESSAGEFIELD (   FieldName,
  Type,
  Description 
)

Convenience macro to define a MessageField.

Declare a field to be used in a CompositeMessage. See the tutorial page on Split Messages for explanations on how to use composite messages and how to split them into their elementary parts

Examples:
tests/test-split-messages.C.
#define NRT_MESSAGEFIELD (   x)

Convenience macro to access a MessageField.

Access a field declared using NRT_DECLARE_MESSAGEFIELD(FieldName, Type, Description), to use it in a CompositeMessage. See the tutorial page on Split Messages for explanations on how to use composite messages and how to split them into their elementary parts

Function Documentation

template<typename T >
std::unique_ptr<T> nrt::make_unique ( T *const  object)
inline

Wrap an std::unique_ptr around the given object pointer.

Note that this cannot be used to do:

Port::post( make_unique( new Message ) );

Instead, it's necessary to do:

auto message = make_unique( new Message() ) );
Port::post( message );
Examples:
tests/test-TransformManager.C.

Definition at line 77 of file MessageHelpers.H.