|
VR-Engage
2.3
|
Allows for managing the lifetime of multiple handler connections using a single manager instance.
#include <vreMessageManager.h>
Public Member Functions | |
| DtVreMessageHandlerGroup () | |
| virtual | ~DtVreMessageHandlerGroup () |
| template<class OBJECT_T> | |
| void | connect (const std::string &messageType, OBJECT_T *object, DtVreMessageResult(OBJECT_T::*method)(DtVreMessage *), DtVreMessageManager::HandlerPosition position=DtVreMessageManager::HandlerPosition::BACK) |
| void | connect (const std::string &messageType, DtVreMessageResult(*function)(DtVreMessage *), DtVreMessageManager::HandlerPosition position=DtVreMessageManager::HandlerPosition::BACK) |
| template<typename Callable> | |
| void | connect (const std::string &messageType, Callable &&callable, DtVreMessageManager::HandlerPosition position=DtVreMessageManager::HandlerPosition::BACK) |
| bool | isConnected (const std::string &messageType) const |
| void | disconnect (const std::string &messageType) |
| void | disconnectAll () |
Protected Attributes | |
| std::map< std::string, std::shared_ptr< DtVreMessageHandler > > | myConnectors |
|
inline |
|
inlinevirtual |
|
inline |
Connects a handler method to a specific message type.
Creates a new Connector instance to manage the lifetime of the connection. The Connector is added to the manager's map and will automatically disconnect when the manager instance is destroyed, so there is no need for explicit disconnect calls, unless it is necessary to disconnect the handler before the manager is destroyed.
| OBJECT_T | The type of the object that will handle messages |
| messageType | The type of message to connect to |
| object | Pointer to the object that will handle messages |
| method | Pointer to the member function that will handle messages |
| position | The position in the handler list (front or back). Optional, defaults to back |
References makVre::DtVreMessageManager::BACK, and myConnectors.
|
inline |
Connects a free function or static member function to a specific message type.
Creates a new Connector instance to manage the lifetime of the connection. The Connector is added to the manager's map and will automatically disconnect when the manager instance is destroyed, so there is no need for explicit disconnect calls, unless it is necessary to disconnect the handler before the manager is destroyed.
| messageType | The type of message to connect to |
| function | Pointer to the function that will handle messages |
| position | The position in the handler list (front or back). Optional, defaults to back |
References makVre::DtVreMessageManager::BACK, and myConnectors.
|
inline |
Connects a callable handler to a specific message type.
| Callable | The type of the callable that will handle messages |
| messageType | The type of message to connect to |
| callable | The callable that will handle messages |
| position | The position in the handler list (front or back). Optional, defaults to back |
References makVre::DtVreMessageManager::BACK, and myConnectors.
|
inline |
Checks if a handler is currently connected for a specific message type.
| messageType | The type of message to check |
References myConnectors.
|
inline |
Disconnects a handler from a specific message type.
| messageType | The type of message to disconnect from |
References myConnectors.
|
inline |
Disconnects all handlers for all message types.
References myConnectors.
|
protected |
Referenced by connect(), connect(), connect(), disconnect(), disconnectAll(), and isConnected().