Guest User

boxoffice.hpp

a guest
Feb 27th, 2015
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. /*
  2.  * The boxoffice is a singleton that acts as a broker between the files
  3.  * contained in boxes and the subscribers/publishers. It uses the shared queue
  4.  * pattern of ZeroMQ so that subscribers forward their received messages
  5.  * to the boxoffice and the boxoffice prepares the messages for the
  6.  * publishers to send.
  7.  * Boxoffice shall only be used within the boxoffice thread.
  8.  */
  9.  
  10. #ifndef SB_BOXOFFICE_HPP
  11. #define SB_BOXOFFICE_HPP
  12.  
  13. #include <zmq.hpp>
  14.  
  15. class Boxoffice
  16. {
  17.   public:
  18.     Boxoffice(const Boxoffice&) = delete;
  19.     Boxoffice& operator=(const Boxoffice&) = delete;
  20.  
  21.     static Boxoffice* getInstance()
  22.     {
  23.       static Boxoffice bo_instance_;
  24.       return &bo_instance_;
  25.     }
  26.  
  27.     static Boxoffice* initialize(zmq::context_t* z_ctx);
  28.  
  29.   private:
  30.     Boxoffice() {};
  31.     ~Boxoffice() {};
  32.  
  33.     int connectToPubsAndSubs(zmq::context_t* z_ctx);
  34. };
  35.  
  36. #endif
Advertisement
Add Comment
Please, Sign In to add comment