|
CIRCT 22.0.0git
|
A logical chunk of data representing serialized data. More...
#include <Common.h>

Public Member Functions | |
| MessageData ()=default | |
| Adopts the data vector buffer. | |
| MessageData (std::span< const uint8_t > data) | |
| MessageData (std::vector< uint8_t > &data) | |
| MessageData (std::vector< uint8_t > &&data) | |
| MessageData (const uint8_t *data, size_t size) | |
| ~MessageData ()=default | |
| const uint8_t * | getBytes () const |
| const std::vector< uint8_t > & | getData () const |
| Get the data as a vector of bytes. | |
| operator const std::vector< uint8_t > & () const | |
| Implicit conversion to a vector/span of bytes, to play nice with other APIs that accept bytearray-like things. | |
| operator std::span< const uint8_t > () const | |
| std::vector< uint8_t > | takeData () |
| Move the data out of this object. | |
| size_t | getSize () const |
| Get the size of the data in bytes. | |
| size_t | size () const |
| bool | empty () const |
| Returns true if this message contains no data. | |
| template<typename T > | |
| const T * | as () const |
| Cast to a type. | |
| std::string | toHex () const |
| Convert the data to a hex string. | |
Static Public Member Functions | |
| template<typename T > | |
| static MessageData | from (T &t) |
| Cast from a type to its raw bytes. | |
Private Attributes | |
| std::vector< uint8_t > | data |
A logical chunk of data representing serialized data.
Currently, just a wrapper for a vector of bytes, which is not efficient in terms of memory copying. This will change in the future as will the API.
|
default |
Adopts the data vector buffer.
Referenced by from().
|
inline |
|
inline |
|
inline |
|
inline |
|
default |
|
inline |
Cast to a type.
Throws if the size of the data does not match the size of the message. The lifetime of the resulting pointer is tied to the lifetime of this object.
Definition at line 148 of file Common.h.
References data.
Referenced by loopbackAddTest().
|
inline |
|
inlinestatic |
Cast from a type to its raw bytes.
Definition at line 158 of file Common.h.
References MessageData().
Referenced by esi::services::TelemetryService::Metric::read().
|
inline |
Definition at line 124 of file Common.h.
References data.
Referenced by log(), PYBIND11_MODULE(), and sv2cCosimserverEpTryGet().
|
inline |
|
inline |
Get the size of the data in bytes.
Definition at line 138 of file Common.h.
References data.
Referenced by log(), PYBIND11_MODULE(), size(), and sv2cCosimserverEpTryGet().
|
inline |
|
inline |
|
inline |
Definition at line 139 of file Common.h.
References getSize().
Referenced by esiaccel.types.ArrayType::bit_width(), esiaccel.types.ArrayType::deserialize(), and esiaccel.types.ArrayType::is_valid().
|
inline |
| std::string MessageData::toHex | ( | ) | const |
|
private |
Definition at line 166 of file Common.h.
Referenced by as(), empty(), getBytes(), getData(), getSize(), operator const std::vector< uint8_t > &(), operator std::span< const uint8_t >(), takeData(), and toHex().