26namespace parcel::descriptor {
35enum class CellCategory { Primitive, TypedList, List, TypedMap, Map, Struct, Union, Custom };
37NLOHMANN_JSON_SERIALIZE_ENUM(CellCategory,
39 {CellCategory::Primitive,
"primitive"},
40 {CellCategory::TypedList,
"typed_list"},
41 {CellCategory::List,
"list"},
42 {CellCategory::TypedMap,
"typed_map"},
43 {CellCategory::Map,
"map"},
44 {CellCategory::Struct,
"struct"},
45 {CellCategory::Union,
"union"},
46 {CellCategory::Custom,
"custom"},
66 [[nodiscard]]
virtual std::string_view
kind()
const = 0;
103 [[nodiscard]]
virtual std::string_view
key()
const = 0;
106 [[nodiscard]]
virtual std::string_view
kind()
const = 0;
152 [[nodiscard]]
virtual std::vector<std::string_view>
sub_kinds()
const = 0;
170 static constexpr std::string_view
kind_id = T::kind_id;
178 [[nodiscard]] std::string_view
kind()
const override {
187 return std::type_index(
typeid(
typename T::storage_t));
232 return descriptor::CellCategory::Primitive;
236 return T::from_json(j, reg);
Core ICell interface, cell_t handle, BaseCell CRTP base, and CellLike concept.
std::shared_ptr< ICell > cell_t
Shared handle to any ICell-derived value — the canonical cell pointer.
Definition cell.h:68
CRTP base that fills in the boilerplate of every cell-type descriptor.
Definition descriptor.h:165
json_t base_to_json() const
Common JSON skeleton (kind, display_info, category) reused by overrides.
Definition descriptor.h:202
BaseCellTypeDescriptor(DisplayInfo info)
Construct with the given display info.
Definition descriptor.h:176
static constexpr std::string_view kind_id
Wire-stable kind id, lifted from T::kind_id.
Definition descriptor.h:170
DisplayInfo display_info() const override
Display info for this cell type.
Definition descriptor.h:182
json_t to_json() const override
Serialize the descriptor itself (kind + display info + category + extras).
Definition descriptor.h:190
std::type_index storage_type() const override
std::type_index of the cell's storage type.
Definition descriptor.h:186
std::string_view kind() const override
Wire-stable kind identifier.
Definition descriptor.h:178
DisplayInfo display_info_
Stored display info.
Definition descriptor.h:196
Runtime catalog of cell-type descriptors, keyed by wire kind id.
Definition registry.h:115
Plain descriptor for cells in the Primitive category.
Definition descriptor.h:220
cell_t cell_from_json(const json_t &j, const ParcelRegistry ®) const override
Construct a cell from JSON, dispatching to the concrete from_json.
Definition descriptor.h:235
descriptor::CellCategory category() const override
Coarse classification (primitive, list, struct, …).
Definition descriptor.h:231
SimpleCellTypeDescriptor(DisplayInfo info)
Construct with the given display info.
Definition descriptor.h:228
The shared vocabulary aliases re-exported from commons and the compile-time kind-id machinery.
comms::DisplayInfo DisplayInfo
Display info attached to a cell or descriptor — re-exported from comms::DisplayInfo.
Definition common.h:75
std::map< std::string, field_descriptor_t > field_descriptors_t
Ordered map of field key → descriptor.
Definition descriptor.h:125
CellCategory
Coarse runtime classification of a cell type.
Definition descriptor.h:35
std::shared_ptr< IFieldDescriptor > field_descriptor_t
Shared handle to a field descriptor.
Definition descriptor.h:122
nlohmann::json json_t
Project-wide alias for nlohmann::json.
Definition json.h:19
Runtime descriptor for a cell type — type-erased face of a CellLike.
Definition descriptor.h:62
virtual descriptor::CellCategory category() const =0
Coarse classification (primitive, list, struct, …).
virtual json_t to_json() const =0
Serialize the descriptor itself (kind + display info + category + extras).
virtual DisplayInfo display_info() const =0
Display info for this cell type.
virtual std::string_view kind() const =0
Wire-stable kind identifier.
virtual cell_t cell_from_json(const json_t &j, ParcelRegistry const ®) const =0
Construct a cell from JSON, dispatching to the concrete from_json.
virtual std::type_index storage_type() const =0
std::type_index of the cell's storage type.
Runtime descriptor for a single struct field.
Definition descriptor.h:99
virtual json_t to_json() const =0
Serialize the field descriptor itself.
virtual std::string_view key() const =0
JSON key under which this field appears in "v".
virtual bool is_required() const =0
Whether the field must be present on deserialization.
virtual DisplayInfo display_info() const =0
Display info for this field.
virtual std::string_view kind() const =0
Cell kind id for the field's value type.
Mix-in declaring a descriptor exposes a static set of named fields.
Definition descriptor.h:133
virtual field_descriptors_t fields() const =0
Field descriptors keyed by JSON key.
Mix-in declaring a descriptor refers to other registered cell kinds.
Definition descriptor.h:148
virtual std::vector< std::string_view > sub_kinds() const =0
Sub-kind ids reachable from this descriptor.