1 #ifndef CHIMERATK_DOOCS_BACKEND_ZMQSUBSCRIPTIONMANAGER_H
2 #define CHIMERATK_DOOCS_BACKEND_ZMQSUBSCRIPTIONMANAGER_H
6 #include <ChimeraTK/Exception.h>
8 #include <boost/shared_ptr.hpp>
18 class DoocsBackendRegisterAccessorBase;
21 namespace DoocsBackendNamespace {
52 void activateSubscription(
const std::string& path);
55 void deactivateSubscription(
const std::string& path);
58 void pollInitialValue(
const std::string& path,
const std::list<DoocsBackendRegisterAccessorBase*>& accessors);
64 bool dmsgStartCalled{
false};
65 std::mutex dmsgStartCalled_mutex;
69 Subscription() : zqmThreadId(ZMQSubscriptionManager::pthread_t_invalid) {}
74 std::vector<DoocsBackendRegisterAccessorBase*> listeners;
77 std::mutex listeners_mutex;
82 pthread_t zqmThreadId;
92 std::condition_variable startedCv{};
100 bool gotInitialValue{
false};
106 static pthread_t pthread_t_invalid;
109 std::map<std::string, Subscription> subscriptionMap;
112 std::mutex subscriptionMap_mutex;
118 static void zmq_callback(
void*
self, doocs::EqData* data, dmsg_info_t* info);
125 #endif // CHIMERATK_DOOCS_BACKEND_ZMQSUBSCRIPTIONMANAGER_H