38 using ID = std::string;
50 throw std::runtime_error(
"Serialization not implemented for type " +
id);
57 throw std::runtime_error(
"Deserialization not implemented for type " +
id);
71 throw std::runtime_error(
"Validation not implemented for type " +
id);
76 std::optional<std::string>
isValid(
const std::any &obj)
const {
80 }
catch (
const std::runtime_error &e) {
86 void dump(std::ostream &os,
bool oneLine =
false)
const;
89 std::string
toString(
bool oneLine =
false)
const;
104 std::vector<std::tuple<std::string, Direction, const Type *>>;
112 std::pair<const Type *, Direction>
findChannel(std::string name)
const;
127 void ensureValid(
const std::any &obj)
const override;
143 void ensureValid(
const std::any &obj)
const override;
166 "TypeAliasType must have a non-null inner type");
176 void ensureValid(
const std::any &obj)
const override;
204 void ensureValid(
const std::any &obj)
const override;
219 using IntegerType::IntegerType;
222 void ensureValid(
const std::any &obj)
const override;
230 using IntegerType::IntegerType;
233 void ensureValid(
const std::any &obj)
const override;
241 using FieldVector = std::vector<std::pair<std::string, const Type *>>;
249 std::ptrdiff_t size = 0;
251 std::ptrdiff_t fieldSize = ty->getBitWidth();
259 void ensureValid(
const std::any &obj)
const override;
290 return elementSize *
size;
293 void ensureValid(
const std::any &obj)
const override;
assert(baseType &&"element must be base type")
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).
Type aliases provide a named type which forwards to an inner type.
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.
TypeAliasType(const ID &id, std::string name, const Type *innerType)
const Type * getInnerType() 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).
const std::string & getName() const
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