1#ifndef CHIMERATK_DOOCS_BACKEND_ZMQSUBSCRIPTIONMANAGER_H
2#define CHIMERATK_DOOCS_BACKEND_ZMQSUBSCRIPTIONMANAGER_H
4#include <ChimeraTK/Exception.h>
6#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);
Backend to access DOOCS control system servers.
static ZMQSubscriptionManager & getInstance()
void deactivateAllListenersAndPushException(DoocsBackend *backend)
Deactivate all listeners for the given backend and push exceptions into the queues.
void activateAllListeners(DoocsBackend *backend)
Activate all listeners for the given backend. Should be called from DoocsBackend::activateAsyncRead()...
void unsubscribe(const std::string &path, DoocsBackendRegisterAccessorBase *accessor)
Unregister accessor subscription.
void deactivateAllListeners(DoocsBackend *backend)
Deactivate all listeners the given backend. Should be called from DoocsBackend::close().
void subscribe(const std::string &path, DoocsBackendRegisterAccessorBase *accessor)
Register accessor subscription.
This is the untemplated base class which unifies all data members not depending on the UserType.