|
VR-Engage
2.3
|
Resuable generic message type supports variable parameters using template methods.
Does not support network replication. Use only within the application instance.
#include <localMessage.h>
Classes | |
| struct | Parameter |
| struct | ParameterBase |
Public Types | |
| using | ParameterMap = std::map<std::string, std::shared_ptr<ParameterBase>> |
Public Member Functions | |
| virtual void | setType (const std::string &type) |
| virtual | ~DtLocalMessage () override |
| virtual const std::string & | type () const override |
| virtual const makVre::DtVreMessageId & | messageId () const override |
| virtual const ParameterMap & | parameterMap () const |
| template<typename T> | |
| const T & | getParameter (const std::string &name) |
| template<typename T> | |
| void | addParameter (const std::string &name, T data) |
Static Public Member Functions | |
| static DtLocalMessage * | create () |
| static const std::string & | theType () |
| static const makVre::DtVreMessageId & | theId () |
Protected Member Functions | |
| DtLocalMessage () | |
Protected Attributes | |
| DtVreMessageId | myMessageId |
| ParameterMap | myParameters |
Static Protected Attributes | |
| static makVre::DtVreMessageId | theMessageId |
| using makVre::DtLocalMessage::ParameterMap = std::map<std::string, std::shared_ptr<ParameterBase>> |
Type definition for parameter map.
|
overridevirtual |
Virtual destructor.
Cleans up resources used by the message, including allocated Parameter objects.
|
protected |
|
virtual |
Used to define the message type.
Given type string is used to define the (non-static) messageId and messageType, as "local.message.{type}"
References type().
|
static |
Creates a new instance of this message type.
This static method creates a new instance of this message type and returns a pointer to the specific message type, avoiding the need for casting by the caller.
References DtLocalMessage().
|
static |
|
static |
|
overridevirtual |
|
overridevirtual |
Gets the message ID object.
This pure virtual method must be implemented by derived classes to return a unique identifier object for the message. The message ID contains both the type name and a hash value for efficient routing.
Implements makVre::DtVreMessage.
|
virtual |
Return const ref to parameter map.
References addParameter(), and getParameter().
| const T & makVre::DtLocalMessage::getParameter | ( | const std::string & | name | ) |
Return value of parameter with given name.
| T | Type of parameter value |
| name | Name of parameter to find |
References DtASSERT, and myParameters.
Referenced by parameterMap().
| void makVre::DtLocalMessage::addParameter | ( | const std::string & | name, |
| T | data ) |
Adds an parameter to this message.
| T | Type of the parameter value |
| name | Name of the parameter |
| data | Value of the parameter |
References myParameters.
Referenced by parameterMap().
|
staticprotected |
Static message ID for this message type.
This static member holds the unique identifier for this message type.
|
protected |
Holds a type ID for this message.
|
protected |
List of parameters for this message.
Referenced by addParameter(), and getParameter().