FREEDM DGI
CDispatcher.hpp
Go to the documentation of this file.
1 
34 #ifndef CDISPATCHER_HPP
35 #define CDISPATCHER_HPP
36 
37 #include "messages/ModuleMessage.pb.h"
38 
39 #include <boost/noncopyable.hpp>
40 #include <boost/smart_ptr/shared_ptr.hpp>
41 #include <boost/thread/mutex.hpp>
42 
43 #include <map>
44 #include <string>
45 
46 namespace freedm {
47  namespace broker {
48 
49 class IDGIModule;
50 
53  : private boost::noncopyable
54 {
55 public:
57  static CDispatcher& Instance();
58 
60  void HandleRequest(boost::shared_ptr<const ModuleMessage> msg, std::string uuid);
61 
63  void RegisterReadHandler(boost::shared_ptr<IDGIModule> p_handler, std::string id);
64 
65 private:
68 
71  boost::shared_ptr<IDGIModule> h,
72  boost::shared_ptr<const ModuleMessage> msg,
73  std::string uuid);
74 
76  std::multimap<boost::shared_ptr<IDGIModule>, const std::string> m_registrations;
77 };
78 
79 } // namespace broker
80 } // namespace freedm
81 
82 #endif // CDISPATCHER_HPP
83 
void ReadHandlerCallback(boost::shared_ptr< IDGIModule > h, boost::shared_ptr< const ModuleMessage > msg, std::string uuid)
Making the handler calls bindable.
Definition: CDispatcher.cpp:113
void HandleRequest(boost::shared_ptr< const ModuleMessage > msg, std::string uuid)
Schedules a message delivery to the receiving modules.
Definition: CDispatcher.cpp:68
void RegisterReadHandler(boost::shared_ptr< IDGIModule > p_handler, std::string id)
Registers a module&#39;s identifier with the dispatcher.
Definition: CDispatcher.cpp:144
std::multimap< boost::shared_ptr< IDGIModule >, const std::string > m_registrations
Reverse map to get the calling module from the handler pointer.
Definition: CDispatcher.hpp:76
CDispatcher()
Private constructor for the singleton instance.
Definition: CDispatcher.hpp:67
static CDispatcher & Instance()
Access the singleton instance of the CDispatcher.
Definition: CDispatcher.cpp:52
General FREEDM Namespace.
Definition: CBroker.cpp:53
Handles applying read handlers to incoming messages.
Definition: CDispatcher.hpp:52