A class that represents a wamp message in its simplest form. More...
#include <wamp_message.hpp>
Public Types | |
| using | message_fields = std::vector< msgpack::object > |
| A convenience type for representing message fields. | |
Public Member Functions | |
| wamp_message (std::size_t num_fields) | |
| Constructs a wamp message with the given number of fields. More... | |
| wamp_message (std::size_t num_fields, msgpack::zone &&zone) | |
| Constructs a wamp message with the given number of fields. More... | |
| wamp_message (message_fields &&fields, msgpack::zone &&zone) | |
| Constructs a wamp message with the given fields. More... | |
| wamp_message (const wamp_message &other)=delete | |
| wamp_message (wamp_message &&other) | |
| wamp_message & | operator= (const wamp_message &other)=delete |
| wamp_message & | operator= (wamp_message &&other) |
| const msgpack::object & | field (std::size_t index) const |
| Retrieves the field at the specified index. More... | |
| template<typename Type > | |
| Type | field (std::size_t index) |
| Retrieves the field at the specified index. More... | |
| template<typename Type > | |
| void | set_field (std::size_t index, const Type &type) |
| Sets the field at the specified index. More... | |
| bool | is_field_type (std::size_t index, msgpack::type::object_type type) const |
| Determines if the field at the specified index is of the given type. More... | |
| std::size_t | size () const |
| Retrieves the number of fields in the message. More... | |
| const message_fields & | fields () const |
| The message fields. More... | |
| message_fields && | fields () |
| Pilfers the message fields. More... | |
| msgpack::zone && | zone () |
| Pilfers the message zone. More... | |
Detailed Description
A class that represents a wamp message in its simplest form.
[field1, field2, field3, ...]
Although not all arrays are valid wamp messages, this class simply provides the building blocks to construct any type of message.
TODO: Investigate the benefits of creating a hierarchy of wamp message types similar to what has been done for bonefish.
Definition at line 53 of file wamp_message.hpp.
Constructor & Destructor Documentation
| autobahn::wamp_message::wamp_message | ( | std::size_t | num_fields | ) |
Constructs a wamp message with the given number of fields.
- Parameters
-
num_fields The number of fields in the message.
| autobahn::wamp_message::wamp_message | ( | std::size_t | num_fields, |
| msgpack::zone && | zone | ||
| ) |
Constructs a wamp message with the given number of fields.
- Parameters
-
num_fields The number of fields in the message. zone The zone used to allocate fields in the message.
| autobahn::wamp_message::wamp_message | ( | message_fields && | fields, |
| msgpack::zone && | zone | ||
| ) |
Constructs a wamp message with the given fields.
- Parameters
-
fields The fields in the message. zone The zone used to allocate fields in the message.
Member Function Documentation
| const msgpack::object& autobahn::wamp_message::field | ( | std::size_t | index | ) | const |
Retrieves the field at the specified index.
Throws an exception if the index is out of bounds.
- Parameters
-
index The index of the target field.
- Returns
- The retrieved type.
| Type autobahn::wamp_message::field | ( | std::size_t | index | ) |
Retrieves the field at the specified index.
Throws an exception if the index is out of bounds or if the field cannot be retrieved as the specified type.
- Template Parameters
-
Type The field's type.
- Parameters
-
index The index of the target field.
- Returns
- The retrieved type.
| const message_fields& autobahn::wamp_message::fields | ( | ) | const |
The message fields.
- Returns
- The message fields.
| message_fields&& autobahn::wamp_message::fields | ( | ) |
Pilfers the message fields.
- Returns
- The message fields.
| bool autobahn::wamp_message::is_field_type | ( | std::size_t | index, |
| msgpack::type::object_type | type | ||
| ) | const |
Determines if the field at the specified index is of the given type.
- Parameters
-
index The index of the target field. type The field type to check against.
| void autobahn::wamp_message::set_field | ( | std::size_t | index, |
| const Type & | type | ||
| ) |
Sets the field at the specified index.
Throws an exception if the index is out of bounds.
- Template Parameters
-
Type The field's type.
- Parameters
-
index The index of the target field. type The type to store in the target field.
| std::size_t autobahn::wamp_message::size | ( | ) | const |
Retrieves the number of fields in the message.
- Returns
- The number of fields in the message.
| msgpack::zone&& autobahn::wamp_message::zone | ( | ) |
Pilfers the message zone.
- Returns
- The message zone.

1.8.11