Orxonox
0.0.5 Codename: Arcturus
|
NotificationListener interface. More...
#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/orxonox/interfaces/NotificationListener.h>
Public Member Functions | |
NotificationListener () | |
virtual | ~NotificationListener () |
virtual bool | executeCommand (NotificationCommand command, const std::string &sender) |
Executes a command with the NotificationListener This needs to be overloaded by each class inheriting from NotificationListener. More... | |
virtual bool | registerNotification (const std::string &message, const std::string &sender, NotificationMessageType type) |
Registers a notification with the NotificationListener. More... | |
Public Member Functions inherited from orxonox::OrxonoxInterface | |
OrxonoxInterface () | |
Public Member Functions inherited from orxonox::Configurable | |
Configurable () | |
void | setConfigValues () |
Function to collect the SetConfigValue-macro calls. More... | |
Public Member Functions inherited from orxonox::Listable | |
Listable () | |
Constructor: Allocates space in the element list. More... | |
Listable (Context *context) | |
Constructor: Allocates space in the element list and assigns the context. More... | |
virtual | ~Listable () |
Destructor: Removes the object from the object-lists. More... | |
Context * | getContext () const |
void | setContext (Context *context) |
Changes the context. More... | |
void | unregisterObject () |
Removes this object from the object-lists. More... | |
Public Member Functions inherited from orxonox::Identifiable | |
Identifiable () | |
Constructor: Sets the default values. More... | |
virtual | ~Identifiable () |
ORX_FORCEINLINE void * | getDerivedPointer (unsigned int classID) |
Returns a valid pointer of any derived type that is registered in the class hierarchy. More... | |
template<class T > | |
ORX_FORCEINLINE T * | getDerivedPointer (unsigned int classID) |
Version of getDerivedPointer with template. More... | |
template<class T > | |
ORX_FORCEINLINE const T * | getDerivedPointer (unsigned int classID) const |
Const version of getDerivedPointer with template. More... | |
Identifier * | getIdentifier () const |
Returns the Identifier of the object. More... | |
bool | isA (const Identifier *identifier) |
Returns true if the object's class is of the given type or a derivative. More... | |
template<class B > | |
bool | isA (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is of the given type or a derivative. More... | |
bool | isA (const Identifiable *object) |
Returns true if the object's class is of the given type or a derivative. More... | |
bool | isChildOf (const Identifier *identifier) |
Returns true if the object's class is a child of the given type. More... | |
template<class B > | |
bool | isChildOf (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is a child of the given type. More... | |
bool | isChildOf (const Identifiable *object) |
Returns true if the object's class is a child of the given type. More... | |
bool | isDirectChildOf (const Identifier *identifier) |
Returns true if the object's class is a direct child of the given type. More... | |
template<class B > | |
bool | isDirectChildOf (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is a direct child of the given type. More... | |
bool | isDirectChildOf (const Identifiable *object) |
Returns true if the object's class is a direct child of the given type. More... | |
bool | isDirectParentOf (const Identifier *identifier) |
Returns true if the object's class is a direct parent of the given type. More... | |
template<class B > | |
bool | isDirectParentOf (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is a direct parent of the given type. More... | |
bool | isDirectParentOf (const Identifiable *object) |
Returns true if the object's class is a direct child of the given type. More... | |
bool | isExactlyA (const Identifier *identifier) |
Returns true if the object's class is exactly of the given type. More... | |
template<class B > | |
bool | isExactlyA (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is exactly of the given type. More... | |
bool | isExactlyA (const Identifiable *object) |
Returns true if the object's class is exactly of the given type. More... | |
bool | isParentOf (const Identifier *identifier) |
Returns true if the object's class is a parent of the given type. More... | |
template<class B > | |
bool | isParentOf (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is a parent of the given type. More... | |
bool | isParentOf (const Identifiable *object) |
Returns true if the object's class is a parent of the given type. More... | |
Public Member Functions inherited from orxonox::Destroyable | |
Destroyable () | |
Constructor: Sets the default values. More... | |
virtual | ~Destroyable () |
Destructor: Notifies all DestructionListener (for example weak pointers) that this object is being deleted. More... | |
void | destroy () |
Deletes the object if no strong pointers point to this object. More... | |
void | destroyLater () |
Works like destroy() but doesn't destroy the object until the current tick has ended. More... | |
unsigned int | getReferenceCount () const |
Returns the number of strong pointers that point to this object. More... | |
Static Public Member Functions | |
static void | sendCommand (const std::string &command, const std::string &sender=NotificationListener::NONE, NotificationSendMode sendMode=NotificationSendMode::local, unsigned int clientId=0) |
Sends a specified command to the specified client from the specified sender. More... | |
static void | sendHelper (const std::string &message, const std::string &sender, bool isCommand, NotificationMessageType type) |
Helper method to register a notification/execute a command with all NotificationListeners after it has been sent over the network. More... | |
static void | sendNotification (const std::string &message, const std::string &sender=NotificationListener::NONE, NotificationMessageType messageType=NotificationMessageType::info, NotificationSendMode sendMode=NotificationSendMode::local, unsigned int clientId=0) |
Sends a Notification with the specified message to the specified client from the specified sender. More... | |
Static Public Attributes | |
static const std::string | ALL |
Static string to indicate a sender that sends to all NotificationQueues. More... | |
static const std::string | COMMAND_CLEAR |
Commands. More... | |
static const std::string | COMMAND_NONE |
static const std::string | NONE |
Static string to indicate a sender that sends to no specific NotificationQueues. More... | |
Static Protected Member Functions | |
static const std::string & | command2Str (NotificationCommand command) |
Helper method. More... | |
static void | sendNetworkHelper (const std::string &message, const std::string &sender, NotificationSendMode sendMode, unsigned int clientId, bool isCommand=false, NotificationMessageType messageType=NotificationMessageType::info) |
Helper method to send both notifications and commands over the network. More... | |
static NotificationCommand | str2Command (const std::string &string) |
Helper method. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from orxonox::Destroyable | |
virtual void | preDestroy () |
This virtual function is called if destroy() is called and no StrongPtr points to this object. More... | |
NotificationListener interface.
The NotificationListener interface (or more precisely abstract class) presents a means of being informed when a new Notification is sent. The NotificationListener can be used to send a new notification message (with NotificationListener::sendNotification() ) or a new notification command (with NotificationListener::sendCommand() ). Each NotificationListener is then informed about the new Notification and can take appropriate action. Currently the only NotificationListener ist the NotificationManager singleton.
When inheriting from a NotificationListener it is important to provide an appropriate implementation of registerNotification() and executeCommand().
orxonox::NotificationListener::NotificationListener | ( | ) |
|
inlinevirtual |
|
staticprotected |
Helper method.
Converts a command enum into its corresponding string.
command | The command to be converted. |
|
inlinevirtual |
Executes a command with the NotificationListener This needs to be overloaded by each class inheriting from NotificationListener.
command | The command to be executed. |
sender | The sender of the command. |
Reimplemented in orxonox::NotificationManager.
|
inlinevirtual |
Registers a notification with the NotificationListener.
This needs to be overloaded by each class inheriting from NotificationListener.
message | The notification's message. |
sender | The sender of the notification. |
type | The type of the notification. |
Reimplemented in orxonox::NotificationManager.
|
inlinestatic |
Sends a specified command to the specified client from the specified sender.
command | The command that should be sent (and later executed). |
sender | The sender that sent the notification. Default is 'none'. |
sendMode | The mode in which the command is sent, can be 'local' to send the command to the client where this function is executed, 'network' if the command is to be sent to the client with the specified clientID, or 'broadcast' if the command should be sent to all hosts. Default is NotificationSendMode::local. |
clientId | The id of the client the command should be sent to. Default is 0. |
|
static |
Helper method to register a notification/execute a command with all NotificationListeners after it has been sent over the network.
message | The notification/command to be sent/executed. |
sender | The sender that sent the notification/command. |
isCommand | Whether the message is a command or a notification. |
type | The type of the notification. |
|
staticprotected |
Helper method to send both notifications and commands over the network.
message | The message/command that should be sent. |
sender | The sender that sent the notification/command. |
sendMode | The mode in which the notification/command is sent, can be 'local' to send the notification to the client where this function is executed, 'network' if the notification is to be sent to the client with the specified clientID, or 'broadcast' if the notification should be sent to all hosts. |
clientId | The id of the client the notification/command should be sent to. |
isCommand | Whether the message is a notification or a command. |
messageType | The type of the notification, can be either 'info' or 'important'. |
|
inlinestatic |
Sends a Notification with the specified message to the specified client from the specified sender.
message | The message that should be sent. |
sender | The sender that sent the notification. Default is 'none'. |
messageType | The type of the message, can be either 'info' or 'important'. Default is 'info'. |
sendMode | The mode in which the notification is sent, can be 'local' to send the notification to the client where this function is executed, 'network' if the notification is to be sent to the client with the specified clientID, or 'broadcast' if the notification should be sent to all hosts. Default is NotificationSendMode::local. |
clientId | The id of the client the notification should be sent to. Default is 0. |
|
staticprotected |
Helper method.
Converts a string into the enum for a command.
string | The string to be converted. |
|
static |
Static string to indicate a sender that sends to all NotificationQueues.
|
static |
Commands.
|
static |
|
static |
Static string to indicate a sender that sends to no specific NotificationQueues.