|
CIRCT 23.0.0git
|
A concrete flat message backed by a single vector of bytes. 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. | |
| size_t | numSegments () const override |
| Number of segments in the message. | |
| Segment | segment (size_t idx) const override |
| Get a segment by index. | |
| MessageData | toMessageData () const override |
| Flatten all segments into a standard MessageData. | |
Public Member Functions inherited from esi::SegmentedMessageData | |
| virtual | ~SegmentedMessageData ()=default |
| size_t | totalSize () const |
| Total size across all segments. | |
| bool | empty () const |
| True if totalSize() == 0. | |
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 concrete flat message backed by a single vector of bytes.
This is also a one-segment SegmentedMessageData so flat and segmented messages can flow through the same internal APIs.
|
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 190 of file Common.h.
References data.
Referenced by channelTest(), esi::fromMessageData(), loopbackAddTest(), runArrayFunc(), runArrayFunc(), runLoopbackI8(), runOddStructFunc(), and runStructFunc().
|
inline |
|
inlinestatic |
Cast from a type to its raw bytes.
Definition at line 200 of file Common.h.
References MessageData().
Referenced by channelTest(), esi::services::TelemetryService::Metric::read(), runOddStructFunc(), and runStructFunc().
|
inline |
Definition at line 166 of file Common.h.
References data.
Referenced by coordTranslateTest(), esi::SerialListTypeDeserializer< T >::decode(), SerialCoordOutputBatch::TypeDeserializer::decode(), esi::fromMessageData(), log(), NB_MODULE(), runArrayProbe(), runBytePatternConst(), runBytePatternEchoEq(), streamingAddTest(), streamingAddTranslatedTest(), and sv2cCosimserverEpTryGet().
|
inline |
|
inline |
Get the size of the data in bytes.
Definition at line 180 of file Common.h.
References data.
Referenced by coordTranslateTest(), esi::SerialListTypeDeserializer< T >::decode(), SerialCoordOutputBatch::TypeDeserializer::decode(), esi::fromMessageData(), esi::cosim::RpcServer::Impl::handleBinaryFrame(), log(), NB_MODULE(), runArrayProbe(), runBytePatternConst(), runBytePatternEchoEq(), runLoopbackI8(), size(), streamingAddTest(), streamingAddTranslatedTest(), and sv2cCosimserverEpTryGet().
|
inlineoverridevirtual |
Number of segments in the message.
Implements esi::SegmentedMessageData.
|
inline |
|
inline |
|
inlineoverridevirtual |
Get a segment by index.
Implements esi::SegmentedMessageData.
Definition at line 208 of file Common.h.
References data.
|
inline |
Definition at line 181 of file Common.h.
References getSize().
Referenced by esiaccel.types.ArrayType::deserialize(), and esiaccel.types.ArrayType::is_valid().
|
inline |
| std::string MessageData::toHex | ( | ) | const |
|
inlineoverridevirtual |
Flatten all segments into a standard MessageData.
Reimplemented from esi::SegmentedMessageData.
Definition at line 213 of file Common.h.
Referenced by esi::ReadChannelPort::connect().
|
private |
Definition at line 216 of file Common.h.
Referenced by as(), empty(), getBytes(), getData(), getSize(), operator const std::vector< uint8_t > &(), operator std::span< const uint8_t >(), segment(), takeData(), and toHex().