zmqpp  4.1.2
C++ bindings for 0mq (libzmq)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
zmqpp::context Class Reference

The context class represents internal zmq context and io threads. More...

#include <context.hpp>

Public Member Functions

 context ()
 Initialise the 0mq context. More...
 
 ~context () NOEXCEPT
 Closes the 0mq context. More...
 
 context (context &&source) NOEXCEPT
 Move supporting constructor. More...
 
contextoperator= (context &&source) NOEXCEPT
 Move supporting operator. More...
 
void terminate ()
 Terminate the current context. More...
 
void set (context_option const option, int const value)
 Set the value of an option in the underlaying zmq context. More...
 
int get (context_option const option)
 Get a context option from the underlaying zmq context. More...
 
 operator bool () const NOEXCEPT
 Validity checking of the context. More...
 
 operator void * () const NOEXCEPT
 Access to the raw 0mq context. More...
 

Private Member Functions

 context (context const &) ZMQPP_EXPLICITLY_DELETED
 
contextoperator= (context const &) NOEXCEPT ZMQPP_EXPLICITLY_DELETED
 

Private Attributes

void * _context
 

Detailed Description

The context class represents internal zmq context and io threads.

By default the context class will create one thread, however this can be overridden in the constructor.

The context class is the only object that can be considered thread safe.

All sockets using endpoints other than inproc require the context to have at least one thread.

This class is c++0x move supporting and cannot be copied.

Constructor & Destructor Documentation

zmqpp::context::context ( )
inline

Initialise the 0mq context.

The context is thread safe an may be used anywhere in your application, however there is no requirement (other than inproc restrictions) for you to do this.

zmqpp::context::~context ( )
inline

Closes the 0mq context.

Any blocking calls other than a socket close will return with an error.

If there are open sockets will block while zmq internal buffers are processed up to a limit specified by that sockets linger option.

zmqpp::context::context ( context &&  source)
inline

Move supporting constructor.

Allows zero-copy move semantics to be used with this class.

Parameters
sourcea rvalue instance of the object who's internals we wish to steal.
zmqpp::context::context ( context const &  )
private

Member Function Documentation

int zmqpp::context::get ( context_option const  option)

Get a context option from the underlaying zmq context.

Parameters
optiona valid context_option
Returns
context option value
zmqpp::context::operator bool ( ) const
inline

Validity checking of the context.

Checks if the underlying 0mq context for this instance is valid.

Contexts should always be valid unless people are doing 'fun' things with std::move.

Returns
boolean true if the object is valid.
zmqpp::context::operator void * ( ) const
inline

Access to the raw 0mq context.

Returns
void pointer to the underlying 0mq context.
context& zmqpp::context::operator= ( context &&  source)
inline

Move supporting operator.

Allows zero-copy move semantics to be used with this class.

Parameters
sourcean rvalue instance of the context who's internals we wish to steal.
context& zmqpp::context::operator= ( context const &  )
private
void zmqpp::context::set ( context_option const  option,
int const  value 
)

Set the value of an option in the underlaying zmq context.

Parameters
optiona valid context_option
valueto set the option to
void zmqpp::context::terminate ( )

Terminate the current context.

Any blocking calls other than a socket close will return with an error.

If there are open sockets will block while zmq internal buffers are processed up to a limit specified by that sockets linger option.

Member Data Documentation

void* zmqpp::context::_context
private

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