MessageHandler Class Reference

A message handler. More...

#include <yatengine.h>

Inheritance diagram for MessageHandler:

String GenObject MessageRelay

List of all members.

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 NamedStringfilter () const
void setFilter (NamedString *filter)
void setFilter (const char *name, const char *value)
void clearFilter ()

Protected Member Functions

void cleanup ()

Friends

class MessageDispatcher
class MessageRelay


Detailed Description

A message handler.

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.


Constructor & Destructor Documentation

MessageHandler ( const char *  name,
unsigned  priority = 100 
) [explicit]

Creates a new message handler.

Parameters:
name Name of the handled message - may be NULL
priority Priority of the handler, 0 = top

virtual ~MessageHandler (  )  [virtual]

Handler destructor.


Member Function Documentation

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.

Parameters:
msg The received message
Returns:
True to stop processing, false to try other handlers

Implemented in MessageRelay.

unsigned priority (  )  const [inline]

Find out the priority of the handler

Returns:
Stored priority of the handler, 0 = top

const NamedString* filter (  )  const [inline]

Retrieve the filter (if installed) associated to this handler

void setFilter ( NamedString filter  ) 

Set a filter for this handler

Parameters:
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

Parameters:
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

void cleanup (  )  [protected]

Remove the handler from its dispatcher, remove any installed filter. This method is called internally from destruct and the destructor


The documentation for this class was generated from the following file:

Generated on Sat May 28 18:28:23 2011 for Yate by  doxygen 1.5.6