CIRCT 22.0.0git
|
Structs are an ordered collection of fields, each with a name and a type. More...
#include <Types.h>
Public Types | |
using | FieldVector = std::vector< std::pair< std::string, const Type * > > |
![]() | |
using | ID = std::string |
Public Member Functions | |
StructType (const ID &id, const FieldVector &fields, bool reverse=true) | |
const FieldVector & | getFields () const |
std::ptrdiff_t | getBitWidth () const override |
void | ensureValid (const std::any &obj) const override |
Ensure that a std::any object is valid for this type. | |
MessageData | serialize (const std::any &obj) const override |
Serialize an object to MessageData. | |
std::pair< std::any, std::span< const uint8_t > > | deserialize (std::span< const uint8_t > data) const override |
Deserialize from a span of bytes to an object. | |
bool | isReverse () const |
![]() | |
Type (const ID &id) | |
virtual | ~Type ()=default |
ID | getID () const |
std::optional< std::string > | isValid (const std::any &obj) const |
Private Attributes | |
FieldVector | fields |
bool | reverse |
Additional Inherited Members | |
![]() | |
ID | id |
Structs are an ordered collection of fields, each with a name and a type.
using esi::StructType::FieldVector = std::vector<std::pair<std::string, const Type *> > |
|
inline |
|
overridevirtual |
Deserialize from a span of bytes to an object.
Returns the deserialized object as a std::any and a span to the remaining bytes.
Reimplemented from esi::Type.
|
overridevirtual |
Ensure that a std::any object is valid for this type.
Throws std::runtime_error if the object is not valid.
Reimplemented from esi::Type.
Definition at line 270 of file Types.cpp.
References fields.
Referenced by serialize().
|
inlineoverridevirtual |
Reimplemented from esi::Type.
Definition at line 202 of file Types.h.
References getFields().
Referenced by serialize().
|
inline |
|
inline |
|
overridevirtual |
Serialize an object to MessageData.
The object should be passed as a std::any to provide type erasure. Returns a MessageData containing the serialized representation.
Reimplemented from esi::Type.
Definition at line 302 of file Types.cpp.
References ensureValid(), fields, getBitWidth(), and isReverse().
|
private |
Definition at line 226 of file Types.h.
Referenced by esiaccel.types.StructType::bit_width(), esiaccel.types.StructType::deserialize(), ensureValid(), getFields(), esiaccel.types.StructType::is_valid(), serialize(), and esiaccel.types.StructType::serialize().
|
private |
Definition at line 227 of file Types.h.
Referenced by isReverse().