parcel 0.2.2
Wrappable, wire-transferable C++23 value system with JSON serialization
Loading...
Searching...
No Matches
parcel::StructCellTypeDescriptor< Derived, Payload > Class Template Referencefinal

Descriptor for StructCell<Derived, Payload>. More...

#include <struct.h>

Inheritance diagram for parcel::StructCellTypeDescriptor< Derived, Payload >:
Collaboration diagram for parcel::StructCellTypeDescriptor< Derived, Payload >:

Public Member Functions

 StructCellTypeDescriptor (DisplayInfo info, payload_field_descriptors_t fields)
 Construct with display info and the field descriptor list.
 
descriptor::CellCategory category () const override
 Coarse classification (primitive, list, struct, …).
 
cell_t cell_from_json (json_t const &j, ParcelRegistry const &reg) const override
 Construct a cell from JSON, dispatching to the concrete from_json.
 
json_t to_json () const override
 Serialize the descriptor itself (kind + display info + category + extras).
 
field_descriptors_t fields () const override
 Field descriptors keyed by JSON key.
 
std::vector< std::string_view > sub_kinds () const override
 Sub-kind ids reachable from this descriptor.
 
payload_field_descriptors_t const & payload_fields () const
 Read-only access to the typed payload-field descriptors.
 
- Public Member Functions inherited from parcel::BaseCellTypeDescriptor< Derived >
 BaseCellTypeDescriptor (DisplayInfo info)
 Construct with the given display info.
 

Additional Inherited Members

- Static Public Attributes inherited from parcel::BaseCellTypeDescriptor< Derived >
static constexpr std::string_view kind_id
 Wire-stable kind id, lifted from T::kind_id.
 
- Protected Member Functions inherited from parcel::BaseCellTypeDescriptor< Derived >
json_t base_to_json () const
 Common JSON skeleton (kind, display_info, category) reused by overrides.
 
- Protected Attributes inherited from parcel::BaseCellTypeDescriptor< Derived >
DisplayInfo display_info_
 Stored display info.
 

Detailed Description

template<typename Derived, typename Payload>
class parcel::StructCellTypeDescriptor< Derived, Payload >

Descriptor for StructCell<Derived, Payload>.

Implements IHasFields (returns the field descriptors keyed by JSON key) and ISubTypes (returns the cell kinds of every field).

Template Parameters
DerivedThe concrete struct cell type.
PayloadThe plain payload struct.

Constructor & Destructor Documentation

◆ StructCellTypeDescriptor()

template<typename Derived , typename Payload >
parcel::StructCellTypeDescriptor< Derived, Payload >::StructCellTypeDescriptor ( DisplayInfo  info,
payload_field_descriptors_t  fields 
)
inline

Construct with display info and the field descriptor list.

Parameters
infoCell-level display info.
fieldsField descriptor list (typically built via FieldsBuilder).

Member Function Documentation

◆ cell_from_json()

template<typename Derived , typename Payload >
cell_t parcel::StructCellTypeDescriptor< Derived, Payload >::cell_from_json ( json_t const &  j,
ParcelRegistry const &  reg 
) const
inlineoverridevirtual

Construct a cell from JSON, dispatching to the concrete from_json.

Parameters
jJSON object to deserialize.
regRegistry used to resolve nested polymorphic cells.
Returns
Newly built cell handle.
Exceptions
std::runtime_erroron shape or kind mismatch.

Implements parcel::ICellTypeDescriptor.

◆ to_json()

template<typename Derived , typename Payload >
json_t parcel::StructCellTypeDescriptor< Derived, Payload >::to_json ( ) const
inlineoverridevirtual

Serialize the descriptor itself (kind + display info + category + extras).

Returns
JSON object describing this cell type.

Reimplemented from parcel::BaseCellTypeDescriptor< Derived >.


The documentation for this class was generated from the following file: