CIRCT 22.0.0git
|
Root class of the ESI type system. More...
#include <Types.h>
Public Types | |
using | ID = std::string |
Public Member Functions | |
Type (const ID &id) | |
virtual | ~Type ()=default |
ID | getID () const |
virtual std::ptrdiff_t | getBitWidth () const |
virtual MessageData | serialize (const std::any &obj) const |
Serialize an object to MessageData. | |
virtual std::pair< std::any, std::span< const uint8_t > > | deserialize (std::span< const uint8_t > data) const |
Deserialize from a span of bytes to an object. | |
virtual void | ensureValid (const std::any &obj) const |
Ensure that a std::any object is valid for this type. | |
std::optional< std::string > | isValid (const std::any &obj) const |
Protected Attributes | |
ID | id |
using esi::Type::ID = std::string |
|
virtualdefault |
|
inlinevirtual |
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 in esi::ChannelType, esi::VoidType, esi::BitsType, esi::SIntType, esi::UIntType, esi::StructType, and esi::ArrayType.
Definition at line 52 of file Types.h.
Referenced by esi::ChannelType::deserialize().
|
inlinevirtual |
Ensure that a std::any object is valid for this type.
Throws std::runtime_error if the object is not valid.
Reimplemented in esi::ChannelType, esi::VoidType, esi::BitsType, esi::SIntType, esi::UIntType, esi::StructType, and esi::ArrayType.
Definition at line 58 of file Types.h.
Referenced by esi::ChannelType::ensureValid(), esi::ArrayType::ensureValid(), and isValid().
|
inlinevirtual |
Reimplemented in esi::BundleType, esi::ChannelType, esi::VoidType, esi::AnyType, esi::BitVectorType, esi::StructType, and esi::ArrayType.
Definition at line 40 of file Types.h.
Referenced by esi::ChannelType::getBitWidth(), and esi::ArrayType::getBitWidth().
|
inline |
Definition at line 39 of file Types.h.
References id.
Referenced by PYBIND11_MODULE(), esi::Context::registerType(), esi::services::FuncService::Function::toString(), esi::services::CallService::Callback::toString(), and esi::services::TelemetryService::Telemetry::toString().
|
inline |
Definition at line 64 of file Types.h.
References ensureValid().
|
inlinevirtual |
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 in esi::ChannelType, esi::VoidType, esi::BitsType, esi::SIntType, esi::UIntType, esi::StructType, and esi::ArrayType.
Definition at line 45 of file Types.h.
Referenced by esi::ChannelType::serialize(), and esi::ArrayType::serialize().