# class MessageHandler | A message handler. More...
Contains pure virtuals
Full name | `TelEngine::MessageHandler`
Definition | `#include <yatengine.h>`
Inherits | TelEngine::String [public ]
Inherited by | MessageRelay
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- explicit MessageHandler (const char* name, unsigned priority = 100, const char* trackName = 0, bool addPriority = true)
- virtual ~MessageHandler ()
- virtual void destruct ()
- virtual bool received (Message& msg)
- inline unsigned priority () const
- inline const String& trackName () const
- inline void trackName (const char* name)
- inline NamedCounter* objectsCounter () const
- inline const NamedString* filter () const
- void setFilter (NamedString* filter)
- inline void setFilter (const char* name, const char* value)
- void clearFilter ()

#### Protected Methods

- void cleanup ()

## Detailed Description

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.

explicit MessageHandler (const char* name, unsigned priority = 100, const char* trackName = 0, bool addPriority = true) | ### MessageHandler

Creates a new message handler.

Parameters:

name | Name of the handled message - may be NULL
priority | Priority of the handler, 0 = top
trackName | Name to be used in handler tracking
addPriority | True to append :priority to trackName

~MessageHandler () | ### ~MessageHandler

[virtual]

Handler destructor.

void destruct () | ### destruct

[virtual]

Destroys the object, performs cleanup first

Reimplemented from GenObject.

bool received (Message& msg) | ### received

[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

inline unsigned priority () | ### priority

[const]

Find out the priority of the handler

Returns: Stored priority of the handler, 0 = top

inline const String& trackName () | ### trackName

[const]

Retrieve the tracking name of this handler

Returns: Name that is to be used in tracking operation

inline void trackName (const char* name) | ### trackName

Set a new tracking name for this handler. Works only if the handler was not yet inserted into a dispatcher

Parameters:

name | Name that is to be used in tracking operation

inline NamedCounter* objectsCounter () | ### objectsCounter

[const]

Retrive the objects counter associated to this handler

Returns: Pointer to handler's objects counter or NULL

inline const NamedString* filter () | ### filter

[const]

Retrieve the filter (if installed) associated to this handler

void setFilter (NamedString* filter) | ### setFilter

Set a filter for this handler

Parameters:

filter | Pointer to the filter to install, will be owned and destroyed by the handler

inline void setFilter (const char* name, const char* value) | ### setFilter

Set a filter for this handler

Parameters:

name | Name of the parameter to filter
value | Value of the parameter to filter

void clearFilter () | ### clearFilter

Remove and destroy any filter associated to this handler

void cleanup () | ### cleanup

[protected]

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

Generated by: paulc on bussard on Mon Feb 10 13:15:47 2014, using kdoc 2.0a54.