The message dispatch class is used to deliver messages to a callback method by message identifier, see MessageThread.
More...
#include "murl_util_message_dispatch.h"
The message dispatch class is used to deliver messages to a callback method by message identifier, see MessageThread.
◆ Register() [1/2]
template<class MessageClass , class ObjectClass >
Bool Murl::Util::MessageDispatch::Register |
( |
const UInt32 |
messageId, |
|
|
ObjectClass * |
instance, |
|
|
Bool(ObjectClass::*)(AutoPointer< MessageClass >) |
method |
|
) |
| |
|
inline |
Register a method to call for a specified message identifier.
- Template Parameters
-
MessageClass | The type of the message class. |
ObjectClass | The type of the class to call the method. |
- Parameters
-
messageId | The message identifier to register. |
instance | The instance pointer of the class to call the method. |
method | The method pointer to call. |
- Returns
- true if successful, false if the message identifier is already registered.
◆ RegisterDefault() [1/2]
template<class MessageClass , class ObjectClass >
Bool Murl::Util::MessageDispatch::RegisterDefault |
( |
ObjectClass * |
instance, |
|
|
Bool(ObjectClass::*)(AutoPointer< MessageClass >) |
method |
|
) |
| |
|
inline |
Register a default method to call for unknown message identifiers.
- Template Parameters
-
MessageClass | The type of the message class. |
ObjectClass | The type of the class to call the method. |
- Parameters
-
instance | The instance pointer of the class to call the method. |
method | The method pointer to call. |
- Returns
- true if successful, false if the message identifier is already registered.
◆ RegisterTimeout() [1/2]
template<class ObjectClass >
Bool Murl::Util::MessageDispatch::RegisterTimeout |
( |
ObjectClass * |
instance, |
|
|
Bool(ObjectClass::*)(Message::AutoPtr) |
method |
|
) |
| |
|
inline |
Register a method to call for timeout messages.
The timeout message is a Message object with identifier ID_TIMEOUT.
- Template Parameters
-
ObjectClass | The type of the class to call the method. |
- Parameters
-
instance | The instance pointer of the class to call the method. |
method | The method pointer to call. |
- Returns
- true if successful, false if the message identifier is already registered.
◆ Register() [2/2]
Register a callback object for a specified message identifier.
A registered callback is executed by the Dispatch() method if a message with the corresponding identifier is delivered.
- Parameters
-
messageId | The message identifier to register. |
callBack | The callback object to register. |
- Returns
- true if successful, false if the message identifier is already registered.
◆ RegisterDefault() [2/2]
Register the default callback object.
The default callback is executed by the Dispatch() method if a message with a not registered identifier is delivered.
- Parameters
-
callBack | The callback object to register. |
- Returns
- true if successful.
◆ RegisterTimeout() [2/2]
Register the timeout callback object.
- Parameters
-
callBack | The callback object to register. |
- Returns
- true if successful.
◆ Unregister()
virtual Bool Murl::Util::MessageDispatch::Unregister |
( |
UInt32 |
messageId | ) |
|
|
virtual |
Unregister a message identifier.
- Parameters
-
messageId | The message identifier to unregister. |
- Returns
- true if successful, false if the message identifier is not registered.
◆ Dispatch()
Dispatch a message by message identifier.
Execute the registered MessageCallBack of the corresponding message identifier otherwise the default callback is executed.
- Parameters
-
message | The message to deliver. |
- Returns
- true if successful, false if message identifier is not registered or the callback execution failed.
◆ ExecuteTimeout()
virtual Bool Murl::Util::MessageDispatch::ExecuteTimeout |
( |
| ) |
|
|
virtual |
Execute the timeout callback.
- Returns
- true if successful, false if the timeout callback is not registered or the callback execution failed.
The documentation for this class was generated from the following file:
- murl_util_message_dispatch.h