|
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 MutableBitVector | serialize (const std::any &obj) const |
| Serialize an object to a MutableBitVector (LSB-first stream). | |
| virtual std::any | deserialize (BitVector &data) const |
| Deserialize from a BitVector stream (LSB-first). | |
| std::any | deserialize (const MessageData &data) const |
| 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 BitVector stream (LSB-first).
Implementations consume bits from 'data' in-place (via logical right shifts) and return the reconstructed value. Remaining bits stay in 'data'.
Reimplemented in esi::ChannelType, esi::VoidType, esi::BitsType, esi::SIntType, esi::UIntType, esi::StructType, esi::ArrayType, esi::ChannelType, esi::VoidType, esi::BitsType, esi::SIntType, esi::UIntType, esi::StructType, and esi::ArrayType.
Definition at line 54 of file Types.h.
Referenced by esi::ChannelType::deserialize(), esi::StructType::deserialize(), esi::ArrayType::deserialize(), and deserialize().
|
inline |
Definition at line 61 of file Types.h.
References 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 68 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 41 of file Types.h.
Referenced by esi::ChannelType::getBitWidth(), and esi::ArrayType::getBitWidth().
|
inline |
Definition at line 40 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 74 of file Types.h.
References ensureValid().
|
inlinevirtual |
Serialize an object to a MutableBitVector (LSB-first stream).
The object should be passed via std::any. Implementations append fields in the order they are iterated (the first serialized field occupies the least-significant bits of the result).
Reimplemented in esi::ChannelType, esi::VoidType, esi::BitsType, esi::SIntType, esi::UIntType, esi::StructType, and esi::ArrayType.
Definition at line 47 of file Types.h.
Referenced by esi::ChannelType::serialize(), esi::StructType::serialize(), and esi::ArrayType::serialize().