Subversion Repositories HomeAutomation

Rev

Rev 1319 | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. /*
  2.  * Broker.h
  3.  *
  4.  *  Created on: Apr 25, 2009
  5.  *      Author: Mattias Runge
  6.  */
  7.  
  8. #ifndef BROKER_H_
  9. #define BROKER_H_
  10.  
  11. #include <boost/signal.hpp>
  12. #include <boost/make_shared.hpp>
  13. #include "message/Message.h"
  14. #include "log/Logger.h"
  15.  
  16. namespace atom {
  17.  
  18. class Broker
  19. {
  20. public:
  21.     typedef boost::shared_ptr<Broker> Pointer;
  22.  
  23.     ~Broker();
  24.  
  25.     void Connect(const Signal_OnMessage::slot_type &slot);
  26.     void Put(Message::Pointer message);
  27.  
  28.     static Pointer GetInstance();
  29.  
  30. private:
  31.     typedef boost::signal<void(Message::pointer message)> Signal_OnMessage;
  32.  
  33.     Broker();
  34.  
  35.     Signal_OnMessage OnMessage;
  36.  
  37.     log::Logger LOG;
  38.  
  39.     static Pointer instance_;
  40.  
  41.  
  42. };
  43.  
  44. } // namespace atom
  45.  
  46. #endif /* BROKER_H_ */
  47.