Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * The publisher is a singleton that binds sockets where it publishes box
- * state changes for an arbitrary number of (external) subscribers to
- * receive. It shall react on messages from the boxoffice and send the
- * appropriate messages accordingly.
- * Publisher shall only be used within the publisher thread.
- */
- #ifndef SB_PUBLISHER_HPP
- #define SB_PUBLISHER_HPP
- #include <zmq.hpp>
- class Publisher
- {
- public:
- Publisher(const Publisher&) = delete;
- Publisher& operator=(const Publisher&) = delete;
- static Publisher* getInstance()
- {
- static Publisher pub_instance_;
- return &pub_instance_;
- }
- static Publisher* initialize(zmq::context_t* z_ctx);
- int sendExitSignal();
- private:
- Publisher() :
- z_pub_to_bo(),
- z_bo_to_pub()
- {};
- ~Publisher()
- {
- z_pub_to_bo->close();
- z_bo_to_pub->close();
- }
- int connectToBoxoffice(zmq::context_t* z_ctx);
- zmq::socket_t* z_pub_to_bo;
- zmq::socket_t* z_bo_to_pub;
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment