FREEDM DGI
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
freedm::broker::CDispatcher Class Reference

Handles applying read handlers to incoming messages.

#include <CDispatcher.hpp>

Inheritance diagram for freedm::broker::CDispatcher:

Public Member Functions

void HandleRequest (boost::shared_ptr< const ModuleMessage > msg, std::string uuid)
 Schedules a message delivery to the receiving modules. More...
 
void RegisterReadHandler (boost::shared_ptr< IDGIModule > p_handler, std::string id)
 Registers a module's identifier with the dispatcher. More...
 

Static Public Member Functions

static CDispatcherInstance ()
 Access the singleton instance of the CDispatcher. More...
 

Private Member Functions

 CDispatcher ()
 Private constructor for the singleton instance. More...
 
void ReadHandlerCallback (boost::shared_ptr< IDGIModule > h, boost::shared_ptr< const ModuleMessage > msg, std::string uuid)
 Making the handler calls bindable. More...
 

Private Attributes

std::multimap< boost::shared_ptr< IDGIModule >, const std::string > m_registrations
 Reverse map to get the calling module from the handler pointer. More...
 

Constructor & Destructor Documentation

freedm::broker::CDispatcher::CDispatcher ( )
inlineprivate

Member Function Documentation

void freedm::broker::CDispatcher::HandleRequest ( boost::shared_ptr< const ModuleMessage >  msg,
std::string  uuid 
)

CDispatcher::HandleRequest

Description:
Given an input property tree determine which handlers should be given the message out of a pool of modules and schedule the delievery of the message to those modules.
Precondition:
Modules have registered their read handlers.
Postcondition:
Message is scheduled to be delivered to the module.
Parameters
msgThe message to distribute to modules.
uuidThe UUID of the DGI that sent the message.
CDispatcher & freedm::broker::CDispatcher::Instance ( )
static

CDispatcher::Instance

Description:
Access the singleton instance of the Dispatcher
Precondition:
None
Postcondition:
None
Returns
A reference to the dispatcher.
void freedm::broker::CDispatcher::ReadHandlerCallback ( boost::shared_ptr< IDGIModule h,
boost::shared_ptr< const ModuleMessage >  msg,
std::string  uuid 
)
private

CDispatcher::ReadHandlerCallback

Description:
Calls the receiving module's message handler for the received message.
Parameters
hThe module that will receive the message.
msgThe message to deliver to that module.
uuidthe UUID of the peer that sent the message.
void freedm::broker::CDispatcher::RegisterReadHandler ( boost::shared_ptr< IDGIModule handler,
std::string  id 
)

CDispatcher::RegisterReadHandler

Description:
Registers a module to receive messages addressed to a uuid. Every registeredmodule will additionally receive messages addressed to "all". Modules can register as "all" to recieve all messages from all modules.
Parameters
handlerthe module that will receive the message
idthis module will receive messages addressed to id. If id is "all" the module will receiver every message from every other module.

Member Data Documentation

std::multimap<boost::shared_ptr<IDGIModule>, const std::string> freedm::broker::CDispatcher::m_registrations
private

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