#include <apimessage.h>
Public Member Functions | |
| APIMessage ()=default | |
| virtual | ~APIMessage () |
| APIMessage (const APIEvent &apiEvent) | |
| APIMessage (const std::string &name) | |
| template<typename T , typename... Args> | |
| std::unique_ptr< T > | toEvent (Args &&... args) |
| bool | toJSON (std::string &outString, utility::ErrorState &error) |
Public Member Functions inherited from Resource | |
| Resource () | |
Public Member Functions inherited from Object | |
| Object () | |
| virtual | ~Object () |
| virtual bool | init (utility::ErrorState &errorState) |
| virtual void | onDestroy () |
| Object (Object &)=delete | |
| Object & | operator= (const Object &)=delete |
| Object (Object &&)=delete | |
| Object & | operator= (Object &&)=delete |
Public Attributes | |
| std::vector< APIBaseValue * > | mArguments |
| Property: 'Arguments': All input arguments associated with this message. More... | |
| std::string | mName |
| Property: 'Name': action associated with the message. More... | |
Public Attributes inherited from Object | |
| std::string | mID |
| Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Object | |
| static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
Represents a message that can be given to a running NAP application by calling APIService::sendMessage(). When doing so the message is converted into an api event, which is the runtime version of an api message. For convenience, an api event can also be converted into a message and therefore serialized to JSON. This allows for an easy exchange of messages from and to a NAP application.
Note that the 'mID' of the message needs to be unique when sending multiple messages as a bundle from an external environment. The 'Name' of the message is used to find a matching callback with the same name inside the running application. When the name of the message matches the signature of the callback that callback is invoked.
|
default |
|
virtual |
| APIMessage | ( | const APIEvent & | apiEvent | ) |
Constructs this message based on the given api event. All arguments in the api events are copied into this object.
| apiEvent | the event to convert into a message. |
| APIMessage | ( | const std::string & | name | ) |
Constructs this message based on the given name
| name | the name (action) associated with this message |
| std::unique_ptr< T > toEvent | ( | Args &&... | args | ) |
Converts this message, including all of it's arguments into an api event of type T. This event is the runtime version of an api message.
| args | extra input arguments given on construction to api-event of type T. |
| bool toJSON | ( | std::string & | outString, |
| utility::ErrorState & | error | ||
| ) |
Converts this message into a JSON readable string
| outString | the output of the conversion |
| error | contains the error if the message couldn't be converted into a string |
| std::vector<APIBaseValue*> mArguments |
Property: 'Arguments': All input arguments associated with this message.
| std::string mName |
Property: 'Name': action associated with the message.