librdkafka
The Apache Kafka C/C++ client library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
RdKafka::Headers::Header Class Reference

Header object. More...

#include <rdkafkacpp.h>

Public Member Functions

 Header (const std::string &key, const void *value, size_t value_size)
 Header object to encapsulate a single Header. More...
 
 Header (const std::string &key, const void *value, size_t value_size, const RdKafka::ErrorCode err)
 Header object to encapsulate a single Header. More...
 
 Header (const Header &other)
 Copy constructor. More...
 
Headeroperator= (const Header &other)
 Assignment operator. More...
 
std::string key () const
 
const void * value () const
 
const char * value_string () const
 
size_t value_size () const
 
RdKafka::ErrorCode err () const
 

Detailed Description

Header object.

This object represents a single Header with a key value pair and an ErrorCode

Remarks
dynamic allocation of this object is not supported.

Constructor & Destructor Documentation

RdKafka::Headers::Header::Header ( const std::string &  key,
const void *  value,
size_t  value_size 
)
inline

Header object to encapsulate a single Header.

Parameters
keythe string value for the header key
valuethe bytes of the header value, or NULL
value_sizethe length in bytes of the header value
Remarks
key and value are copied.
RdKafka::Headers::Header::Header ( const std::string &  key,
const void *  value,
size_t  value_size,
const RdKafka::ErrorCode  err 
)
inline

Header object to encapsulate a single Header.

Parameters
keythe string value for the header key
valuethe bytes of the header value
value_sizethe length in bytes of the header value
errthe error code if one returned
Remarks
The error code is used for when the Header is constructed internally by using RdKafka::Headers::get_last which constructs a Header encapsulating the ErrorCode in the process. If err is set, the value and value_size fields will be undefined.
RdKafka::Headers::Header::Header ( const Header other)
inline

Copy constructor.

Parameters
otherHeader to make a copy of.

Member Function Documentation

Header& RdKafka::Headers::Header::operator= ( const Header other)
inline

Assignment operator.

Parameters
otherHeader to make a copy of.
std::string RdKafka::Headers::Header::key ( ) const
inline
Returns
the key/name associated with this Header
const void* RdKafka::Headers::Header::value ( ) const
inline
Returns
returns the binary value, or NULL
const char* RdKafka::Headers::Header::value_string ( ) const
inline
Returns
returns the value casted to a nul-terminated C string, or NULL.
size_t RdKafka::Headers::Header::value_size ( ) const
inline
Returns
Value Size the length of the Value in bytes
RdKafka::ErrorCode RdKafka::Headers::Header::err ( ) const
inline
Returns
the error code of this Header (usually ERR_NO_ERROR)

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