MADARA  3.2.3
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:
72 
74  void * context_;
75 
77  std::atomic<int> references_;
78  };
79 
80  extern MADARA_EXPORT ZMQContext zmq_context;
81  }
82 }
83 
84 #endif // _MADARA_ZEROMQ_CONTEXT_H_
MADARA_EXPORT ZMQContext zmq_context
Definition: ZMQContext.cpp:5
void * context_
the context
Definition: ZMQContext.h:74
std::atomic< int > references_
track the number of references to the context
Definition: ZMQContext.h:77
void * get_context()
Retrieves the underlying ZMQ context.
Definition: ZMQContext.h:46
Copyright (c) 2015 Carnegie Mellon University.
A class that manages a ZMQ context.
Definition: ZMQContext.h:23