MADARA  3.4.1
madara::transport::ZMQContext Class Reference

A class that manages a ZMQ context. More...

#include <ZMQContext.h>

Public Member Functions

 ZMQContext ()
 Constructor. More...
 
 ~ZMQContext ()
 Destructor. More...
 
void add_ref (void)
 Adds a reference to the context. More...
 
void destroy_context (void)
 Destroys the underlying context. More...
 
void * get_context ()
 Retrieves the underlying ZMQ context. More...
 
void rem_ref (void)
 Removes a reference to the context. More...
 
void set_context (void *context)
 Retrieves the underlying ZMQ context. More...
 

Private Attributes

void * context_
 the context More...
 
std::atomic< int > references_
 track the number of references to the context More...
 

Detailed Description

A class that manages a ZMQ context.

Definition at line 23 of file ZMQContext.h.

Constructor & Destructor Documentation

◆ ZMQContext()

madara::transport::ZMQContext::ZMQContext ( )

Constructor.

Parameters
contextthe context to manage

Definition at line 7 of file ZMQContext.cpp.

◆ ~ZMQContext()

madara::transport::ZMQContext::~ZMQContext ( )

Destructor.

Definition at line 101 of file ZMQContext.cpp.

Member Function Documentation

◆ add_ref()

void madara::transport::ZMQContext::add_ref ( void  )

Adds a reference to the context.

This is useful for very lazy compilers that do not forcefully call destructors of global variables, such as VS apparently does.

Definition at line 37 of file ZMQContext.cpp.

◆ destroy_context()

void madara::transport::ZMQContext::destroy_context ( void  )

Destroys the underlying context.

Definition at line 83 of file ZMQContext.cpp.

◆ get_context()

void* madara::transport::ZMQContext::get_context ( void  )
inline

Retrieves the underlying ZMQ context.

Returns
current ZMQ context

Definition at line 46 of file ZMQContext.h.

◆ rem_ref()

void madara::transport::ZMQContext::rem_ref ( void  )

Removes a reference to the context.

This is useful for very lazy compilers that do not forcefully call destructors of global variables, such as VS apparently does.

Definition at line 60 of file ZMQContext.cpp.

◆ set_context()

void madara::transport::ZMQContext::set_context ( void *  context)

Retrieves the underlying ZMQ context.

Parameters
contextthe context to manage

Definition at line 9 of file ZMQContext.cpp.

Member Data Documentation

◆ context_

void* madara::transport::ZMQContext::context_
private

the context

Definition at line 73 of file ZMQContext.h.

◆ references_

std::atomic<int> madara::transport::ZMQContext::references_
private

track the number of references to the context

Definition at line 76 of file ZMQContext.h.


The documentation for this class was generated from the following files: