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::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. | |
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 |
|
default |
|
inline |
|
inline |
|
inlinestatic |
Cast from a type to its raw bytes.
Definition at line 147 of file Common.h.
References MessageData().
|
inline |
Definition at line 114 of file Common.h.
References data.
Referenced by log(), PYBIND11_MODULE(), and sv2cCosimserverEpTryGet().
|
inline |
Get the data as a vector of bytes.
Definition at line 117 of file Common.h.
References data.
Referenced by esi::ArrayType::serialize().
|
inline |
Get the size of the data in bytes.
Definition at line 128 of file Common.h.
References data.
Referenced by log(), PYBIND11_MODULE(), and sv2cCosimserverEpTryGet().
|
inline |
|
inline |
|
inline |
std::string MessageData::toHex | ( | ) | const |
|
private |
Definition at line 155 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().