MADARA  3.4.1
ZMQContext.h
Go to the documentation of this file.
1 #ifndef _MADARA_ZEROMQ_CONTEXT_H_
2 #define _MADARA_ZEROMQ_CONTEXT_H_
3 
12 #include "madara/MadaraExport.h"
13 #include <atomic>
14 
15 namespace madara
16 {
17 namespace transport
18 {
23 class MADARA_EXPORT ZMQContext
24 {
25 public:
30  ZMQContext();
31 
35  ~ZMQContext();
36 
40  void destroy_context(void);
41 
46  inline void* get_context()
47  {
48  return context_;
49  }
50 
55  void set_context(void* context);
56 
62  void add_ref(void);
63 
69  void rem_ref(void);
70 
71 private:
73  void* context_;
74 
76  std::atomic<int> references_;
77 };
78 
79 extern MADARA_EXPORT ZMQContext zmq_context;
80 }
81 }
82 
83 #endif // _MADARA_ZEROMQ_CONTEXT_H_
const ThreadSafeContext * context_
A class that manages a ZMQ context.
Definition: ZMQContext.h:24
void * get_context()
Retrieves the underlying ZMQ context.
Definition: ZMQContext.h:46
void * context_
the context
Definition: ZMQContext.h:73
std::atomic< int > references_
track the number of references to the context
Definition: ZMQContext.h:76
MADARA_EXPORT ZMQContext zmq_context
Definition: ZMQContext.cpp:5
Copyright(c) 2020 Galois.