ark::serialization::Schema
Defined in header “ark/serialization/schema.hh”.
A schema represents a programmatic way to serialize and deserialize messages from just a schema (ie, without a concrete type). This can be helpful for external tools that want to decode data without compiling code.
Methods
-
std::string type_name()
Convenience routine, to return the type name of this schema. This is an identifier able to uniquely identify this schema. -
std::vector< FieldDescriptor > all_fields()
Covenience routine. Returns all fields in this schema, if they are base fields, or grouped fields. -
bool has_fields()
Returns true if this schema contains any fields, in either the main list, or the optional groups. -
std::optional< FieldDescriptor > field(const std::string_view & name)
Returns the given field, if present. Returns an empty optional otherwise. -
bool has_attribute(SchemaAttribute attribute)
Returns true if the given attribute is set, false otherwise. -
void validate()
Validates this schema, checking to ensure that basic contracts are met. Throws if the schema fails validation. -
bool operator==(const Schema & other)
Default comparison.
Variables
-
std::string name
The name of this message. -
std::string object_namespace
The namespace this message belongs to. -
std::vector< FieldDescriptor > fields
A list of the fields belonging to this message. -
std::vector< OptionalGroup > groups
A list of the optional groups belonging to this message. -
std::vector< std::string > comments
A list of comments associated with this schema. -
SchemaAttribute attributes= SchemaAttribute::NONE
Any attributes applied to this schema. -
std::optional< SourceLocation > source_location
An optional source location (may or may not be present).