#include <yatengine.h>
Public Member Functions | |
MessageHandler (const char *name, unsigned priority=100) | |
virtual | ~MessageHandler () |
virtual void | destruct () |
virtual bool | received (Message &msg)=0 |
unsigned | priority () const |
const NamedString * | filter () const |
void | setFilter (NamedString *filter) |
void | setFilter (const char *name, const char *value) |
void | clearFilter () |
Friends | |
class | MessageDispatcher |
The purpose of this class is to hold a message received method that is called for matching messages. It holds as well the matching criteria and priority among other handlers.
MessageHandler | ( | const char * | name, | |
unsigned | priority = 100 | |||
) |
Creates a new message handler.
name | Name of the handled message - may be NULL | |
priority | Priority of the handler, 0 = top |
virtual ~MessageHandler | ( | ) | [virtual] |
Handler destructor.
virtual void destruct | ( | ) | [virtual] |
Destroys the object, performs cleanup first
Reimplemented from GenObject.
virtual bool received | ( | Message & | msg | ) | [pure virtual] |
This method is called whenever the registered name matches the message.
msg | The received message |
Implemented in MessageRelay.
unsigned priority | ( | ) | const [inline] |
Find out the priority of the handler
const NamedString* filter | ( | ) | const [inline] |
Retrive the filter (if installed) associated to this handler
void setFilter | ( | NamedString * | filter | ) |
Set a filter for this handler
filter | Pointer to the filter to install, will be owned and destroyed by the handler |
void setFilter | ( | const char * | name, | |
const char * | value | |||
) | [inline] |
Set a filter for this handler
name | Name of the parameter to filter | |
value | Value of the parameter to filter |
void clearFilter | ( | ) |
Remove and destroy any filter associated to this handler