Messager Class Reference

Objects that are capable of sending messages. More...

#include <messager.h>

Inheritance diagram for Messager:

Inheritance graph
[legend]
Collaboration diagram for Messager:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Messager ()
virtual ~Messager ()
void add_recipient (const Messageable *)
 Add a recipient to our recipient list.
void del_recipient (const Messageable *)
 Remove a recipient from our recipient list.
void send_message (MessageP &) const
 Send a message to all of our recipients.

Protected Types

typedef std::list< Messageable * >
::iterator 
recipient_iterator
typedef std::list< Messageable * >
::const_iterator 
recipient_const_iterator

Protected Attributes

std::list< Messageable * > recipients
pthread_mutex_t recip_mutex
 mutex to protect recipients


Detailed Description

Objects that are capable of sending messages.

Definition at line 16 of file messager.h.


Member Typedef Documentation

typedef std::list<Messageable*>::iterator Messager::recipient_iterator [protected]

Definition at line 42 of file messager.h.

typedef std::list<Messageable*>::const_iterator Messager::recipient_const_iterator [protected]

Definition at line 44 of file messager.h.


Constructor & Destructor Documentation

Messager::Messager (  ) 

Definition at line 11 of file messager.cc.

References PTHREAD_CHECK_AND_THROW, and recip_mutex.

Messager::~Messager ( void   )  [virtual]

Definition at line 21 of file messager.cc.

References PTHREAD_CHECK_AND_THROW, and recip_mutex.


Member Function Documentation

void Messager::add_recipient ( const Messageable outlet  ) 

Add a recipient to our recipient list.

Definition at line 33 of file messager.cc.

References recip_mutex, and recipients.

Referenced by Incoming::listener_thread(), main(), ConnEventHandler::operator()(), and MasterController::start_connections().

Here is the caller graph for this function:

void Messager::del_recipient ( const Messageable messageable  ) 

Remove a recipient from our recipient list.

Definition at line 47 of file messager.cc.

References recip_mutex, and recipients.

Referenced by invalidate_messageable::operator()().

Here is the caller graph for this function:

void Messager::send_message ( MessageP message  )  const

Send a message to all of our recipients.

Enqueue a message onto each Messageable in our recipient list.

Parameters:
message The Message to send

Definition at line 60 of file messager.cc.

References Message::M_Data, recip_mutex, and recipients.

Referenced by BiDirConn::reader().

Here is the caller graph for this function:


Member Data Documentation

std::list<Messageable*> Messager::recipients [protected]

Todo:
The list of recipients in Messager is currently a std::list of Messageable*'s. This is atypical of the way we're handling this sort of thing now, where we're generally trying to use Loki::SmartPtr rather than standard unreferenced pointers. Is it safe to just treat all such Messageable objects as MessageableP's, and then we can dynamic_cast the contained pointer when needed to determine if it's an Outlet, or the like? This will work, becasue Messageable is a super-class of Connection, but is it the right thing to do?

Definition at line 40 of file messager.h.

Referenced by add_recipient(), del_recipient(), MasterController::destroy_children(), send_message(), and MasterController::start_connections().

pthread_mutex_t Messager::recip_mutex [protected]


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

Generated on Tue May 13 11:32:49 2008 for consmgr by  doxygen 1.5.5