AMPS C/C++ Client Class Reference AMPS C/C++ Client Version 5.3.5.1

Public Member Functions | List of all members
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...
CompositeMessageBuilder & | append (const std::string &data_)
| Appends a message part to this object. More...
CompositeMessageBuilder & | append (const char *data_, size_t length_)
| Appends a message part to this object. More...
CompositeMessageBuilder & | clear (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

## ◆ CompositeMessageBuilder()

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

## ◆ append() [1/2]

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.

## ◆ append() [2/2]

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.

## ◆ clear()

CompositeMessageBuilder & AMPS::CompositeMessageBuilder::clear | ( | void |  | ) |
| inline

Clears this object.

Does not resize or free internal buffer.

Returns
  this object.

## ◆ data()

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.

## ◆ length()

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:

- include/amps/CompositeMessageBuilder.hpp