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

a zmq message with optional multipart support More...

#include <message.hpp>

Collaboration diagram for zmqpp::message:
Collaboration graph
[legend]

Public Types

typedef std::function< void(void *)> release_function
 callback to release user allocated data. More...
 

Public Member Functions

 message ()
 
 ~message ()
 
template<typename T , typename... Args>
 message (T const &part, Args &&...args)
 
size_t parts () const
 
size_t size (size_t const part) const
 
std::string get (size_t const part) const
 
void get (int8_t &integer, size_t const part) const
 
void get (int16_t &integer, size_t const part) const
 
void get (int32_t &integer, size_t const part) const
 
void get (int64_t &integer, size_t const part) const
 
void get (signal &sig, size_t const part) const
 
void get (uint8_t &unsigned_integer, size_t const part) const
 
void get (uint16_t &unsigned_integer, size_t const part) const
 
void get (uint32_t &unsigned_integer, size_t const part) const
 
void get (uint64_t &unsigned_integer, size_t const part) const
 
void get (float &floating_point, size_t const part) const
 
void get (double &double_precision, size_t const part) const
 
void get (bool &boolean, size_t const part) const
 
void get (std::string &string, size_t const part) const
 
template<typename Type >
Type get (size_t const part)
 
template<int part = 0, typename T , typename... Args>
void extract (T &nextpart, Args &...args)
 
template<int part = 0, typename T >
void extract (T &nextpart)
 
template<typename Type >
void get (Type *&value, size_t const part) const
 
template<typename Type >
void get (Type **value, size_t const part) const
 
void move (void *part, size_t const size, release_function const &release)
 
template<typename Object >
void move (Object *part)
 
template<typename Type , typename... Args>
void add (Type const &part, Args &&...args)
 
template<typename Type >
void add (Type const part)
 
template<typename Type >
void add_raw (Type *part, size_t const data_size)
 
template<typename Type >
void add_const (Type *part, size_t const data_size)
 
void reset_read_cursor ()
 
template<typename Type >
messageoperator>> (Type &value)
 
messageoperator<< (int8_t const integer)
 
messageoperator<< (int16_t const integer)
 
messageoperator<< (int32_t const integer)
 
messageoperator<< (int64_t const integer)
 
messageoperator<< (signal const sig)
 
messageoperator<< (uint8_t const unsigned_integer)
 
messageoperator<< (uint16_t const unsigned_integer)
 
messageoperator<< (uint32_t const unsigned_integer)
 
messageoperator<< (uint64_t const unsigned_integer)
 
messageoperator<< (float const floating_point)
 
messageoperator<< (double const double_precision)
 
messageoperator<< (bool const boolean)
 
messageoperator<< (char const *c_string)
 
messageoperator<< (std::string const &string)
 
void push_front (void const *part, size_t const size)
 
void push_front (int8_t const integer)
 
void push_front (int16_t const integer)
 
void push_front (int32_t const integer)
 
void push_front (int64_t const integer)
 
void push_front (signal const sig)
 
void push_front (uint8_t const unsigned_integer)
 
void push_front (uint16_t const unsigned_integer)
 
void push_front (uint32_t const unsigned_integer)
 
void push_front (uint64_t const unsigned_integer)
 
void push_front (float const floating_point)
 
void push_front (double const double_precision)
 
void push_front (bool const boolean)
 
void push_front (char const *c_string)
 
void push_front (std::string const &string)
 
void pop_front ()
 
void push_back (void const *part, size_t const data_size)
 
template<typename Type >
void push_back (Type const part)
 
void pop_back ()
 
void remove (size_t const part)
 
 message (message &&source) NOEXCEPT
 
messageoperator= (message &&source) NOEXCEPT
 
message copy () const
 
void copy (message const &source)
 
void sent (size_t const part)
 
void const * raw_data (size_t const part=0) const
 
zmq_msg_t & raw_msg (size_t const part=0)
 
zmq_msg_t & raw_new_msg ()
 
zmq_msg_t & raw_new_msg (size_t const reserve_data_size)
 
bool is_signal () const
 Check if the message is a signal. More...
 
size_t read_cursor () const NOEXCEPT
 Gets the read cursor. More...
 
size_t remaining () const NOEXCEPT
 Gets the remaining number of parts in the message. More...
 
size_t next () NOEXCEPT
 Moves the read cursor to the next element. More...
 

Private Types

typedef std::vector< frameparts_type
 

Private Member Functions

 message (message const &) NOEXCEPT ZMQPP_EXPLICITLY_DELETED
 
messageoperator= (message const &) NOEXCEPT ZMQPP_EXPLICITLY_DELETED
 

Static Private Member Functions

static void release_callback (void *data, void *hint)
 
template<typename Object >
static void deleter_callback (void *data)
 

Private Attributes

parts_type _parts
 
size_t _read_cursor
 

Detailed Description

a zmq message with optional multipart support

A zmq message is made up of one or more parts which are sent together to the target endpoints. zmq guarantees either the whole message or none of the message will be delivered.

Member Typedef Documentation

typedef std::vector<frame> zmqpp::message::parts_type
private
typedef std::function<void (void*)> zmqpp::message::release_function

callback to release user allocated data.

The release function will be called on any void* moved part. It must be thread safe to the extent that the callback may occur on one of the context threads.

The function called will be passed a single variable which is the pointer to the memory allocated.

Constructor & Destructor Documentation

zmqpp::message::message ( )
zmqpp::message::~message ( )
template<typename T , typename... Args>
zmqpp::message::message ( T const &  part,
Args &&...  args 
)
inline
zmqpp::message::message ( message &&  source)
zmqpp::message::message ( message const &  )
private

Member Function Documentation

template<typename Type , typename... Args>
void zmqpp::message::add ( Type const &  part,
Args &&...  args 
)
inline
template<typename Type >
void zmqpp::message::add ( Type const  part)
inline
template<typename Type >
void zmqpp::message::add_const ( Type *  part,
size_t const  data_size 
)
inline
template<typename Type >
void zmqpp::message::add_raw ( Type *  part,
size_t const  data_size 
)
inline
message zmqpp::message::copy ( ) const
void zmqpp::message::copy ( message const &  source)
template<typename Object >
static void zmqpp::message::deleter_callback ( void *  data)
inlinestaticprivate
template<int part = 0, typename T , typename... Args>
void zmqpp::message::extract ( T &  nextpart,
Args &...  args 
)
inline
template<int part = 0, typename T >
void zmqpp::message::extract ( T &  nextpart)
inline
std::string zmqpp::message::get ( size_t const  part) const
void zmqpp::message::get ( int8_t &  integer,
size_t const  part 
) const
void zmqpp::message::get ( int16_t &  integer,
size_t const  part 
) const
void zmqpp::message::get ( int32_t &  integer,
size_t const  part 
) const
void zmqpp::message::get ( int64_t &  integer,
size_t const  part 
) const
void zmqpp::message::get ( signal sig,
size_t const  part 
) const
void zmqpp::message::get ( uint8_t &  unsigned_integer,
size_t const  part 
) const
void zmqpp::message::get ( uint16_t &  unsigned_integer,
size_t const  part 
) const
void zmqpp::message::get ( uint32_t &  unsigned_integer,
size_t const  part 
) const
void zmqpp::message::get ( uint64_t &  unsigned_integer,
size_t const  part 
) const
void zmqpp::message::get ( float &  floating_point,
size_t const  part 
) const
void zmqpp::message::get ( double &  double_precision,
size_t const  part 
) const
void zmqpp::message::get ( bool &  boolean,
size_t const  part 
) const
void zmqpp::message::get ( std::string &  string,
size_t const  part 
) const
template<typename Type >
Type zmqpp::message::get ( size_t const  part)
inline
template<typename Type >
void zmqpp::message::get ( Type *&  value,
size_t const  part 
) const
inline
template<typename Type >
void zmqpp::message::get ( Type **  value,
size_t const  part 
) const
inline
bool zmqpp::message::is_signal ( ) const

Check if the message is a signal.

If the message has 1 part, has the correct size and if the 7 first bytes match the signal header we consider the message a signal.

Returns
true if the message is a signal, false otherwise
void zmqpp::message::move ( void *  part,
size_t const  size,
release_function const &  release 
)
template<typename Object >
void zmqpp::message::move ( Object *  part)
inline
size_t zmqpp::message::next ( )
inline

Moves the read cursor to the next element.

Returns
the new read_cursor
message & zmqpp::message::operator<< ( int8_t const  integer)
message & zmqpp::message::operator<< ( int16_t const  integer)
message & zmqpp::message::operator<< ( int32_t const  integer)
message & zmqpp::message::operator<< ( int64_t const  integer)
message & zmqpp::message::operator<< ( signal const  sig)
message & zmqpp::message::operator<< ( uint8_t const  unsigned_integer)
message & zmqpp::message::operator<< ( uint16_t const  unsigned_integer)
message & zmqpp::message::operator<< ( uint32_t const  unsigned_integer)
message & zmqpp::message::operator<< ( uint64_t const  unsigned_integer)
message & zmqpp::message::operator<< ( float const  floating_point)
message & zmqpp::message::operator<< ( double const  double_precision)
message & zmqpp::message::operator<< ( bool const  boolean)
message & zmqpp::message::operator<< ( char const *  c_string)
message & zmqpp::message::operator<< ( std::string const &  string)
message & zmqpp::message::operator= ( message &&  source)
message& zmqpp::message::operator= ( message const &  )
private
template<typename Type >
message& zmqpp::message::operator>> ( Type &  value)
inline
size_t zmqpp::message::parts ( ) const
void zmqpp::message::pop_back ( )
void zmqpp::message::pop_front ( )
void zmqpp::message::push_back ( void const *  part,
size_t const  data_size 
)
inline
template<typename Type >
void zmqpp::message::push_back ( Type const  part)
inline
void zmqpp::message::push_front ( void const *  part,
size_t const  size 
)
void zmqpp::message::push_front ( int8_t const  integer)
void zmqpp::message::push_front ( int16_t const  integer)
void zmqpp::message::push_front ( int32_t const  integer)
void zmqpp::message::push_front ( int64_t const  integer)
void zmqpp::message::push_front ( signal const  sig)
void zmqpp::message::push_front ( uint8_t const  unsigned_integer)
void zmqpp::message::push_front ( uint16_t const  unsigned_integer)
void zmqpp::message::push_front ( uint32_t const  unsigned_integer)
void zmqpp::message::push_front ( uint64_t const  unsigned_integer)
void zmqpp::message::push_front ( float const  floating_point)
void zmqpp::message::push_front ( double const  double_precision)
void zmqpp::message::push_front ( bool const  boolean)
void zmqpp::message::push_front ( char const *  c_string)
void zmqpp::message::push_front ( std::string const &  string)
void const * zmqpp::message::raw_data ( size_t const  part = 0) const
zmq_msg_t & zmqpp::message::raw_msg ( size_t const  part = 0)
zmq_msg_t & zmqpp::message::raw_new_msg ( )
zmq_msg_t & zmqpp::message::raw_new_msg ( size_t const  reserve_data_size)
size_t zmqpp::message::read_cursor ( ) const
inline

Gets the read cursor.

For using get_raw() with stream-style reading.

void zmqpp::message::release_callback ( void *  data,
void *  hint 
)
staticprivate
size_t zmqpp::message::remaining ( ) const
inline

Gets the remaining number of parts in the message.

void zmqpp::message::remove ( size_t const  part)
void zmqpp::message::reset_read_cursor ( )
void zmqpp::message::sent ( size_t const  part)
size_t zmqpp::message::size ( size_t const  part) const

Member Data Documentation

parts_type zmqpp::message::_parts
private
size_t zmqpp::message::_read_cursor
private

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