Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

rfc822::filter::filter Class Reference

a message filter. More...

#include <filter.h>

Inheritance diagram for rfc822::filter::filter::

rfc822::filter::conditional rfc822::filter::mboxwriter List of all members.

Public Methods

 filter ()
 c'tor. More...

virtual ~filter ()
 d'tor. More...

bool no_loop_check ()
 check loops. More...

virtual void onMsg (const msg &)
 receive a message. More...

virtual void onCleanup ()
 stops filtering. More...

virtual void onInit ()
 initializes filtering. More...

void connect (const string &outgoing, filter &dest, bool fConnect=true)
 connects a filter with a target. More...

void connect (filter &dest, bool fConnect=true)

Static Public Methods

void connect (filter &src, filter &dest, bool fConnect=true)
void connect (filter &src, const string &outgoing, filter &dest, bool fConnect=true)
template<class T> void copy (T &in, filter &f)
 copies a message collection into a filter. More...

void copy (const msg &in, filter &f)
 copies an individual message into a filter. More...


Protected Methods

void redirect (const msg &m, const string &slot)
 redirects a message. More...

void redirect (const msg &m)
 sends a message to all recipients exactly once. More...


Detailed Description

a message filter.

filter objects are used to filter (that's where the name is from ;-) individual messages.

filter objects have one incoming slot (the onMsg() method), in which they receive the messages to handle. The filter::connect() methods are used to connect any number of outgoing slots to incoming slots of other filter objects.

Incoming messages are handled via the onMsg() method, which may change a message and redirect() it to zero, one, or more named outgoing slots.


Constructor & Destructor Documentation

rfc822::filter::filter::filter  
 

c'tor.

virtual rfc822::filter::filter::~filter   [virtual]
 

d'tor.


Member Function Documentation

void rfc822::filter::filter::connect filter &    src,
const string   outgoing,
filter &    dest,
bool    fConnect = true
[inline, static]
 

void rfc822::filter::filter::connect filter &    src,
filter &    dest,
bool    fConnect = true
[inline, static]
 

void rfc822::filter::filter::connect filter &    dest,
bool    fConnect = true
 

void rfc822::filter::filter::connect const string   outgoing,
filter &    dest,
bool    fConnect = true
 

connects a filter with a target.

Using this method one may establish a "filter chain" or "filter graph".

Parameters:
src  the source filter.
outgoing  the name of the outgoing slot.
dest  the destination filter.
fConnect  when set a connection is established; otherwise a connection is removed.
Once connected, each message received by the src filter, which is directed to the outgoing slot via src's redirect() method, is send to the dest filter object.

Note that you cannot connect a filter to a slot more than once.

void rfc822::filter::filter::copy const msg   in,
filter &    f
[static]
 

copies an individual message into a filter.

template<class T>
void rfc822::filter::filter::copy T &    in,
filter &    f
[static]
 

copies a message collection into a filter.

bool rfc822::filter::filter::no_loop_check  
 

check loops.

call this method to check for loops. It returns false if the current filter graph forms a loop. In such a situation it is dangerous to run the filter, as infinite recursion could occur.

virtual void rfc822::filter::filter::onCleanup   [virtual]
 

stops filtering.

When called no additional messages are to be expected. Use this method to do cleanup, statistics etc.pp.

virtual void rfc822::filter::filter::onInit   [virtual]
 

initializes filtering.

When called no additional messages are to be expected. Use this method to do initialization etc.pp.

virtual void rfc822::filter::filter::onMsg const msg   [virtual]
 

receive a message.

filter objects receive messages via this method. They then are able to do whatever they want with it.

The default implementation sends the message to all targets of the filter object.

void rfc822::filter::filter::redirect const msg   m [protected]
 

sends a message to all recipients exactly once.

void rfc822::filter::filter::redirect const msg   m,
const string   slot
[protected]
 

redirects a message.

sends the message m to the named slot slot, i.e. all destination filters that are connected with that slot by means of the connect() method are sent the message.

Parameters:
m  the message to redirect.
slot  name of the outgoing slot. When set to "" the message is delivered to each destination filter exactly once.


The documentation for this class was generated from the following file:
Generated on Mon Oct 22 17:03:48 2001 for rfc822 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001