Base Message Dispatcher. More...
Public Member Functions | |
| Dispatcher (Defs::DispatcherID a_dispatcherID, const std::string &a_dispatcherName) | |
| Ctor. | |
| virtual | ~Dispatcher () |
| Dtor. | |
| virtual void | shutdownAll () |
| shutsdown and removes all handlers | |
| virtual bool | registerMessageHandler (Service *, MessageEventInfo::SharedPtr &pMEI) |
| Register a service with the MessageDispatcher. | |
| virtual bool | unRegisterMessageHandler (Service *) |
| UnRegister a service from the MessageDispatcher. | |
| virtual void | postUrgentMessage (Tonido::Data::Message::SharedPtr &message) |
| Posts an Urgent message to the Dispatcher to be dispatched. | |
| virtual void | postMessage (Tonido::Data::Message::SharedPtr &message) |
| Posts a message to the Dispatcher to be dispatched. | |
| virtual void | postMessage (Tonido::Data::Message a_message) |
| Posts a message to the Dispatcher to be dispatched. | |
| virtual void | run () |
| run | |
| Defs::DispatcherID | dispatcherId () const |
| Get the ID of this dispatcher. | |
| std::string | dispatcherName () const |
| Gets the Dispatcher Name. | |
Protected Types | |
|
typedef BootHashMap < std::string, MessageEventInfo::SharedPtr > | DispatchTable |
| typedef DispatchTable::iterator | NonConstDispatchIter |
|
typedef std::pair< std::string, MessageEventInfo::SharedPtr > | DispatchPair |
|
typedef DispatchTable::const_iterator | DispatchIter |
Protected Attributes | |
| DispatchTable | m_dispatchDirectory |
| HashMap for Dispatching. | |
| Poco::Thread | m_workerThread |
| Worker Thread. | |
| volatile bool | m_timeToDie |
| Helper to kill the thread. | |
| Poco::Event | m_workerRunningEvent |
| Poco::NotificationQueue | m_incomingQueue |
| Poco::FastMutex | m_mutex |
| Poco::FastMutex | m_destructMutex |
| StatsGroup * | m_pStatgroup |
| Defs::DispatcherID | m_dispatcherID |
| std::string | m_dispatcherName |
Base Message Dispatcher.
This is the base class for message dispatchers. Any dispatcher serivce would need to be derive from this class
| Tonido::System::Dispatcher::Dispatcher | ( | Defs::DispatcherID | a_dispatcherID, |
| const std::string & | a_dispatcherName | ||
| ) |
Ctor.
details if needed ...
| Tonido::System::Dispatcher::~Dispatcher | ( | ) | [virtual] |
Dtor.
details if needed ...
| Defs::DispatcherID Tonido::System::Dispatcher::dispatcherId | ( | ) | const |
Get the ID of this dispatcher.
This allows services to tell which context they are being invoked from.
| std::string Tonido::System::Dispatcher::dispatcherName | ( | ) | const |
Gets the Dispatcher Name.
Utility function that returns the name of the dispatcher
| bool Tonido::System::Dispatcher::registerMessageHandler | ( | Service * | a_pService, |
| MessageEventInfo::SharedPtr & | pMEI | ||
| ) | [virtual] |
Register a service with the MessageDispatcher.
This is the function called by services to register themselves.
Reimplemented in Tonido::System::MessageDispatcher.
| void Tonido::System::Dispatcher::run | ( | ) | [virtual] |
run
Internal function for thread running
| void Tonido::System::Dispatcher::shutdownAll | ( | ) | [virtual] |
shutsdown and removes all handlers
shutsdown and unregisters all handlers
| bool Tonido::System::Dispatcher::unRegisterMessageHandler | ( | Service * | a_pService | ) | [virtual] |
UnRegister a service from the MessageDispatcher.
same notes as registerServiceActive
Reimplemented in Tonido::System::MessageDispatcher.
DispatchTable Tonido::System::Dispatcher::m_dispatchDirectory [protected] |
HashMap for Dispatching.
This hash map contains all the services and their associated message handlers