36 using ID = std::string;
48 throw std::runtime_error(
"Serialization not implemented for type " +
id);
55 throw std::runtime_error(
"Deserialization not implemented for type " +
id);
69 throw std::runtime_error(
"Validation not implemented for type " +
id);
74 std::optional<std::string>
isValid(
const std::any &obj)
const {
78 }
catch (
const std::runtime_error &e) {
84 void dump(std::ostream &os,
bool oneLine =
false)
const;
87 std::string
toString(
bool oneLine =
false)
const;
102 std::vector<std::tuple<std::string, Direction, const Type *>>;
110 std::pair<const Type *, Direction>
findChannel(std::string name)
const;
125 void ensureValid(
const std::any &obj)
const override;
141 void ensureValid(
const std::any &obj)
const override;
175 void ensureValid(
const std::any &obj)
const override;
190 using IntegerType::IntegerType;
193 void ensureValid(
const std::any &obj)
const override;
201 using IntegerType::IntegerType;
204 void ensureValid(
const std::any &obj)
const override;
212 using FieldVector = std::vector<std::pair<std::string, const Type *>>;
220 std::ptrdiff_t size = 0;
222 std::ptrdiff_t fieldSize = ty->getBitWidth();
230 void ensureValid(
const std::any &obj)
const override;
261 return elementSize *
size;
264 void ensureValid(
const std::any &obj)
const override;
The "any" type is a special type which can be used to represent any type, as identified by the type i...
std::ptrdiff_t getBitWidth() const override
Arrays have a compile time specified (static) size and an element type.
std::ptrdiff_t getBitWidth() const override
MutableBitVector serialize(const std::any &obj) const override
Serialize an object to a MutableBitVector (LSB-first stream).
void ensureValid(const std::any &obj) const override
Ensure that a std::any object is valid for this type.
std::any deserialize(BitVector &data) const override
Deserialize from a BitVector stream (LSB-first).
const Type * getElementType() const
ArrayType(const ID &id, const Type *elementType, uint64_t size, bool reverse=true)
Bit vectors include signed, unsigned, and signless integers.
BitVectorType(const ID &id, uint64_t width)
std::ptrdiff_t getBitWidth() const override
uint64_t getWidth() const
A lightweight, non-owning bit vector view backed by a byte array span.
Bits are just an array of bits.
void ensureValid(const std::any &obj) const override
Ensure that a std::any object is valid for this type.
std::any deserialize(BitVector &data) const override
Deserialize from a BitVector stream (LSB-first).
MutableBitVector serialize(const std::any &obj) const override
Serialize an object to a MutableBitVector (LSB-first stream).
Bundles represent a collection of channels.
BundleType(const ID &id, const ChannelVector &channels)
std::ptrdiff_t getBitWidth() const override
const ChannelVector & getChannels() const
std::vector< std::tuple< std::string, Direction, const Type * > > ChannelVector
std::pair< const Type *, Direction > findChannel(std::string name) const
Channels are the basic communication primitives.
void ensureValid(const std::any &obj) const override
Ensure that a std::any object is valid for this type.
MutableBitVector serialize(const std::any &obj) const override
Serialize an object to a MutableBitVector (LSB-first stream).
std::ptrdiff_t getBitWidth() const override
ChannelType(const ID &id, const Type *inner)
const Type * getInner() const
std::any deserialize(BitVector &data) const override
Deserialize from a BitVector stream (LSB-first).
Integers are bit vectors which may be signed or unsigned and are interpreted as numbers.
Lists represent variable-length sequences of elements of a single type.
ListType(const ID &id, const Type *elementType)
std::ptrdiff_t getBitWidth() const override
const Type * getElementType() const
A logical chunk of data representing serialized data.
A mutable bit vector that owns its underlying storage.
std::any deserialize(BitVector &data) const override
Deserialize from a BitVector stream (LSB-first).
MutableBitVector serialize(const std::any &obj) const override
Serialize an object to a MutableBitVector (LSB-first stream).
void ensureValid(const std::any &obj) const override
Ensure that a std::any object is valid for this type.
Structs are an ordered collection of fields, each with a name and a type.
void ensureValid(const std::any &obj) const override
Ensure that a std::any object is valid for this type.
std::vector< std::pair< std::string, const Type * > > FieldVector
std::ptrdiff_t getBitWidth() const override
MutableBitVector serialize(const std::any &obj) const override
Serialize an object to a MutableBitVector (LSB-first stream).
StructType(const ID &id, const FieldVector &fields, bool reverse=true)
const FieldVector & getFields() const
std::any deserialize(BitVector &data) const override
Deserialize from a BitVector stream (LSB-first).
Root class of the ESI type system.
virtual void ensureValid(const std::any &obj) const
Ensure that a std::any object is valid for this type.
std::string toString(bool oneLine=false) const
virtual std::ptrdiff_t getBitWidth() const
std::any deserialize(const MessageData &data) const
virtual std::any deserialize(BitVector &data) const
Deserialize from a BitVector stream (LSB-first).
std::optional< std::string > isValid(const std::any &obj) const
virtual MutableBitVector serialize(const std::any &obj) const
Serialize an object to a MutableBitVector (LSB-first stream).
void dump(std::ostream &os, bool oneLine=false) const
std::any deserialize(BitVector &data) const override
Deserialize from a BitVector stream (LSB-first).
MutableBitVector serialize(const std::any &obj) const override
Serialize an object to a MutableBitVector (LSB-first stream).
void ensureValid(const std::any &obj) const override
Ensure that a std::any object is valid for this type.
The "void" type is a special type which can be used to represent no type.
std::any deserialize(BitVector &data) const override
Deserialize from a BitVector stream (LSB-first).
void ensureValid(const std::any &obj) const override
Ensure that a std::any object is valid for this type.
std::ptrdiff_t getBitWidth() const override
MutableBitVector serialize(const std::any &obj) const override
Serialize an object to a MutableBitVector (LSB-first stream).
Windows represent a fixed-size sliding window over a stream of data.
std::ptrdiff_t getBitWidth() const override
std::vector< Frame > frames
const std::vector< Frame > & getFrames() const
const Type * getLoweredType() const
const std::string & getName() const
const Type * getIntoType() const
WindowType(const ID &id, const std::string &name, const Type *intoType, const Type *loweredType, const std::vector< Frame > &frames)
Field information describing a field within a frame.
Frame information describing which fields are included in a particular frame.
std::vector< Field > fields