Adapts one client nominal record type to and from canonical CEL record values.
More...
template<class T>
struct cel::record_adapter< T >
Adapts one client nominal record type to and from canonical CEL record values.
Specialize this template for one client type T to expose it as a nominal record. type() must return a nominal record descriptor. to_value() must return a value with exactly that descriptor. from_value() should validate complete descriptor identity before decoding and throw std::invalid_argument when mismatched.
Example:
struct point {
double x;
double y;
};
template <>
"sample.point",
return descriptor;
}
static cel::value to_value(const point& source);
static point from_value(const cel::value& source);
};
An immutable, shared semantic type with a canonical byte layout.
Definition value_type.hpp:65
static value_type leaf()
Returns T's descriptor as an opaque, trivially copyable leaf.
Definition value_type.hpp:122
static value_type record(std::string_view identity, std::span< const record_field > fields)
Creates named fields with a nonempty nominal identity.
Adapts one client nominal record type to and from canonical CEL record values.
Definition record_adapter.hpp:38
A source-order name/type pair validated by value_type::record.
Definition value_type.hpp:272