Subversion Repositories HomeAutomation

Rev

Rev 1310 | Go to most recent revision | 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 "../message/Message.h"
  13. #include "../utils/Logger.h"
  14.  
  15. namespace atom {
  16. namespace broker {
  17.  
  18. using namespace std;
  19. using namespace atom::utils;
  20. using namespace atom::message;
  21.  
  22. class Broker
  23. {
  24.     typedef boost::signal<void(Message::pointer message)> OnMessageSignal;
  25.  
  26. public:
  27.     typedef boost::shared_ptr<Broker> pointer;
  28.  
  29.     ~Broker();
  30.  
  31.     void connect(const OnMessageSignal::slot_type & slot);
  32.     void put(Message::pointer message);
  33.  
  34.     static pointer getInstance();
  35.  
  36. private:
  37.     Broker();
  38.  
  39.     static pointer Instance;
  40.  
  41.     OnMessageSignal onNewMessage;
  42.     Logger LOG;
  43. };
  44.  
  45. }
  46. }
  47. #endif /* BROKER_H_ */
  48.