AMPS C/C++ Client Class Reference
AMPS C/C++ Client Version 5.3.4.3
AMPS::CompositeMessageBuilder Class Reference

Used to create payloads for AMPS composite messages, which are messages with a number of parts where each part is a complete message of a specific message type. More...

#include <CompositeMessageBuilder.hpp>

Public Member Functions

 CompositeMessageBuilder (size_t initialCapacity_=DEFAULT_INITIAL_CAPACITY)
 Create a new, empty CompositeMessageBuilder. More...
 
CompositeMessageBuilderappend (const std::string &data_)
 Appends a message part to this object. More...
 
CompositeMessageBuilderappend (const char *data_, size_t length_)
 Appends a message part to this object. More...
 
CompositeMessageBuilderclear (void)
 Clears this object. More...
 
const char * data (void) const
 Returns the composite message's data. More...
 
size_t length (void) const
 Returns the length of the composite message's data. More...
 

Detailed Description

Used to create payloads for AMPS composite messages, which are messages with a number of parts where each part is a complete message of a specific message type.

For example, a composite message type of "composite-json-binary" may be declared on the server that combines a set of JSON headers with an opaque binary payload. CompositeMessageBuilder makes it easy to assemble this payload.

Constructor & Destructor Documentation

AMPS::CompositeMessageBuilder::CompositeMessageBuilder ( size_t  initialCapacity_ = DEFAULT_INITIAL_CAPACITY)
inline

Create a new, empty CompositeMessageBuilder.

Parameters
initialCapacity_The initial capacity (bytes) for this builder.

Member Function Documentation

CompositeMessageBuilder & AMPS::CompositeMessageBuilder::append ( const std::string &  data_)
inline

Appends a message part to this object.

Parameters
data_The data to append.
Returns
this object.
CompositeMessageBuilder & AMPS::CompositeMessageBuilder::append ( const char *  data_,
size_t  length_ 
)
inline

Appends a message part to this object.

Parameters
data_The data to append.
length_The length of the data to append.
Returns
this object.
CompositeMessageBuilder & AMPS::CompositeMessageBuilder::clear ( void  )
inline

Clears this object.

Does not resize or free internal buffer.

Returns
this object.
const char * AMPS::CompositeMessageBuilder::data ( void  ) const
inline

Returns the composite message's data.

Returns
a pointer to the beginning of the composite message data.
size_t AMPS::CompositeMessageBuilder::length ( void  ) const
inline

Returns the length of the composite message's data.

Returns
the length in bytes of the data comprising this message.

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