parcel 0.2.2
Wrappable, wire-transferable C++23 value system with JSON serialization
Loading...
Searching...
No Matches
builtins.h File Reference

register_primitives / register_collections / register_typed_collections / register_std helpers. More...

#include <parcel/commons.h>
#include <parcel/ext/chrono.h>
#include <parcel/ext/filesystem.h>
#include <parcel/ext/ulid.h>
#include <parcel/list.h>
#include <parcel/map.h>
#include <parcel/primitive.h>
#include <parcel/registry.h>
#include <parcel/unordered_map.h>
Include dependency graph for builtins.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

using parcel::CharListCell = TypedListCell< CharCell >
 TypedListCell<CharCell>.
 
using parcel::BoolListCell = TypedListCell< BoolCell >
 TypedListCell<BoolCell>.
 
using parcel::U8ListCell = TypedListCell< U8Cell >
 TypedListCell<U8Cell>.
 
using parcel::U16ListCell = TypedListCell< U16Cell >
 TypedListCell<U16Cell>.
 
using parcel::U32ListCell = TypedListCell< U32Cell >
 TypedListCell<U32Cell>.
 
using parcel::U64ListCell = TypedListCell< U64Cell >
 TypedListCell<U64Cell>.
 
using parcel::I8ListCell = TypedListCell< I8Cell >
 TypedListCell<I8Cell>.
 
using parcel::I16ListCell = TypedListCell< I16Cell >
 TypedListCell<I16Cell>.
 
using parcel::I32ListCell = TypedListCell< I32Cell >
 TypedListCell<I32Cell>.
 
using parcel::I64ListCell = TypedListCell< I64Cell >
 TypedListCell<I64Cell>.
 
using parcel::FloatListCell = TypedListCell< FloatCell >
 TypedListCell<FloatCell>.
 
using parcel::DoubleListCell = TypedListCell< DoubleCell >
 TypedListCell<DoubleCell>.
 
using parcel::StringListCell = TypedListCell< StringCell >
 TypedListCell<StringCell>.
 
using parcel::U128ListCell = TypedListCell< U128Cell >
 TypedListCell<U128Cell>.
 
using parcel::I128ListCell = TypedListCell< I128Cell >
 TypedListCell<I128Cell>.
 
using parcel::CharMapCell = TypedMapCell< CharCell >
 TypedMapCell<CharCell>.
 
using parcel::BoolMapCell = TypedMapCell< BoolCell >
 TypedMapCell<BoolCell>.
 
using parcel::U8MapCell = TypedMapCell< U8Cell >
 TypedMapCell<U8Cell>.
 
using parcel::U16MapCell = TypedMapCell< U16Cell >
 TypedMapCell<U16Cell>.
 
using parcel::U32MapCell = TypedMapCell< U32Cell >
 TypedMapCell<U32Cell>.
 
using parcel::U64MapCell = TypedMapCell< U64Cell >
 TypedMapCell<U64Cell>.
 
using parcel::I8MapCell = TypedMapCell< I8Cell >
 TypedMapCell<I8Cell>.
 
using parcel::I16MapCell = TypedMapCell< I16Cell >
 TypedMapCell<I16Cell>.
 
using parcel::I32MapCell = TypedMapCell< I32Cell >
 TypedMapCell<I32Cell>.
 
using parcel::I64MapCell = TypedMapCell< I64Cell >
 TypedMapCell<I64Cell>.
 
using parcel::FloatMapCell = TypedMapCell< FloatCell >
 TypedMapCell<FloatCell>.
 
using parcel::DoubleMapCell = TypedMapCell< DoubleCell >
 TypedMapCell<DoubleCell>.
 
using parcel::StringMapCell = TypedMapCell< StringCell >
 TypedMapCell<StringCell>.
 
using parcel::U128MapCell = TypedMapCell< U128Cell >
 TypedMapCell<U128Cell>.
 
using parcel::I128MapCell = TypedMapCell< I128Cell >
 TypedMapCell<I128Cell>.
 
using parcel::CharHashMapCell = TypedHashMapCell< CharCell >
 TypedHashMapCell<CharCell>.
 
using parcel::BoolHashMapCell = TypedHashMapCell< BoolCell >
 TypedHashMapCell<BoolCell>.
 
using parcel::U8HashMapCell = TypedHashMapCell< U8Cell >
 TypedHashMapCell<U8Cell>.
 
using parcel::U16HashMapCell = TypedHashMapCell< U16Cell >
 TypedHashMapCell<U16Cell>.
 
using parcel::U32HashMapCell = TypedHashMapCell< U32Cell >
 TypedHashMapCell<U32Cell>.
 
using parcel::U64HashMapCell = TypedHashMapCell< U64Cell >
 TypedHashMapCell<U64Cell>.
 
using parcel::I8HashMapCell = TypedHashMapCell< I8Cell >
 TypedHashMapCell<I8Cell>.
 
using parcel::I16HashMapCell = TypedHashMapCell< I16Cell >
 TypedHashMapCell<I16Cell>.
 
using parcel::I32HashMapCell = TypedHashMapCell< I32Cell >
 TypedHashMapCell<I32Cell>.
 
using parcel::I64HashMapCell = TypedHashMapCell< I64Cell >
 TypedHashMapCell<I64Cell>.
 
using parcel::FloatHashMapCell = TypedHashMapCell< FloatCell >
 TypedHashMapCell<FloatCell>.
 
using parcel::DoubleHashMapCell = TypedHashMapCell< DoubleCell >
 TypedHashMapCell<DoubleCell>.
 
using parcel::StringHashMapCell = TypedHashMapCell< StringCell >
 TypedHashMapCell<StringCell>.
 
using parcel::U128HashMapCell = TypedHashMapCell< U128Cell >
 TypedHashMapCell<U128Cell>.
 
using parcel::I128HashMapCell = TypedHashMapCell< I128Cell >
 TypedHashMapCell<I128Cell>.
 
using parcel::Cs8ListCell = TypedListCell< Cs8Cell >
 TypedListCell<Cs8Cell>.
 
using parcel::Cs16ListCell = TypedListCell< Cs16Cell >
 TypedListCell<Cs16Cell>.
 
using parcel::Cs32ListCell = TypedListCell< Cs32Cell >
 TypedListCell<Cs32Cell>.
 
using parcel::Cs64ListCell = TypedListCell< Cs64Cell >
 TypedListCell<Cs64Cell>.
 
using parcel::Cu8ListCell = TypedListCell< Cu8Cell >
 TypedListCell<Cu8Cell>.
 
using parcel::Cu16ListCell = TypedListCell< Cu16Cell >
 TypedListCell<Cu16Cell>.
 
using parcel::Cu32ListCell = TypedListCell< Cu32Cell >
 TypedListCell<Cu32Cell>.
 
using parcel::Cu64ListCell = TypedListCell< Cu64Cell >
 TypedListCell<Cu64Cell>.
 
using parcel::Cf32ListCell = TypedListCell< Cf32Cell >
 TypedListCell<Cf32Cell>.
 
using parcel::Cf64ListCell = TypedListCell< Cf64Cell >
 TypedListCell<Cf64Cell>.
 
using parcel::Cs8MapCell = TypedMapCell< Cs8Cell >
 TypedMapCell<Cs8Cell>.
 
using parcel::Cs16MapCell = TypedMapCell< Cs16Cell >
 TypedMapCell<Cs16Cell>.
 
using parcel::Cs32MapCell = TypedMapCell< Cs32Cell >
 TypedMapCell<Cs32Cell>.
 
using parcel::Cs64MapCell = TypedMapCell< Cs64Cell >
 TypedMapCell<Cs64Cell>.
 
using parcel::Cu8MapCell = TypedMapCell< Cu8Cell >
 TypedMapCell<Cu8Cell>.
 
using parcel::Cu16MapCell = TypedMapCell< Cu16Cell >
 TypedMapCell<Cu16Cell>.
 
using parcel::Cu32MapCell = TypedMapCell< Cu32Cell >
 TypedMapCell<Cu32Cell>.
 
using parcel::Cu64MapCell = TypedMapCell< Cu64Cell >
 TypedMapCell<Cu64Cell>.
 
using parcel::Cf32MapCell = TypedMapCell< Cf32Cell >
 TypedMapCell<Cf32Cell>.
 
using parcel::Cf64MapCell = TypedMapCell< Cf64Cell >
 TypedMapCell<Cf64Cell>.
 
using parcel::Cs8HashMapCell = TypedHashMapCell< Cs8Cell >
 TypedHashMapCell<Cs8Cell>.
 
using parcel::Cs16HashMapCell = TypedHashMapCell< Cs16Cell >
 TypedHashMapCell<Cs16Cell>.
 
using parcel::Cs32HashMapCell = TypedHashMapCell< Cs32Cell >
 TypedHashMapCell<Cs32Cell>.
 
using parcel::Cs64HashMapCell = TypedHashMapCell< Cs64Cell >
 TypedHashMapCell<Cs64Cell>.
 
using parcel::Cu8HashMapCell = TypedHashMapCell< Cu8Cell >
 TypedHashMapCell<Cu8Cell>.
 
using parcel::Cu16HashMapCell = TypedHashMapCell< Cu16Cell >
 TypedHashMapCell<Cu16Cell>.
 
using parcel::Cu32HashMapCell = TypedHashMapCell< Cu32Cell >
 TypedHashMapCell<Cu32Cell>.
 
using parcel::Cu64HashMapCell = TypedHashMapCell< Cu64Cell >
 TypedHashMapCell<Cu64Cell>.
 
using parcel::Cf32HashMapCell = TypedHashMapCell< Cf32Cell >
 TypedHashMapCell<Cf32Cell>.
 
using parcel::Cf64HashMapCell = TypedHashMapCell< Cf64Cell >
 TypedHashMapCell<Cf64Cell>.
 

Functions

void parcel::register_primitives (ParcelRegistry &reg)
 Register every PrimitiveCell<T> into reg.
 
void parcel::register_collections (ParcelRegistry &reg)
 Register the heterogeneous ListCell, MapCell, and HashMapCell into reg.
 
void parcel::register_typed_collections (ParcelRegistry &reg)
 Register TypedListCell<P>, TypedMapCell<P>, and TypedHashMapCell<P> for every primitive P.
 
void parcel::register_std (ParcelRegistry &reg)
 Register the std-adapter cells into reg.
 
void parcel::register_commons (ParcelRegistry &reg)
 Register the commons-adapter cells into reg.
 
void parcel::register_builtins (ParcelRegistry &reg, const BuiltinsOptions opts={})
 Apply the opts toggles to populate reg with built-in cells.
 

Detailed Description

register_primitives / register_collections / register_typed_collections / register_std helpers.

Convenience aliases for TypedListCell<P> / TypedMapCell<P> / TypedHashMapCell<P> of every primitive P, plus the registration helpers ParcelRegistry's default constructor uses to populate the registry with the standard built-in kinds. Each instantiation has a distinct kind id (e.g. "l:i32", "m:string", "hm:i32"), so the registry can dispatch any typed primitive collection without ambiguity.

register_std registers the std-adapter cells from parcel/ext/chrono.h and parcel/ext/filesystem.h so a default- constructed registry handles std::chrono and std::filesystem payloads out of the box.

Once the registry is populated the aliases let you write:

parcel::I32ListCell nums{1, 2, 3};
parcel::StringMapCell tags{{"role", "admin"}};
Homogeneous list of element cells of type T.
Definition list.h:106
Homogeneous string-keyed map of values of type T.
Definition map.h:106

Function Documentation

◆ register_builtins()

void parcel::register_builtins ( ParcelRegistry reg,
const BuiltinsOptions  opts = {} 
)
inline

Apply the opts toggles to populate reg with built-in cells.

Parameters
regRegistry to populate.
optsToggles for which built-ins to register.

◆ register_collections()

void parcel::register_collections ( ParcelRegistry reg)
inline

Register the heterogeneous ListCell, MapCell, and HashMapCell into reg.

Parameters
regRegistry to populate.

◆ register_commons()

void parcel::register_commons ( ParcelRegistry reg)
inline

Register the commons-adapter cells into reg.

Registers ColorCell, IconCell, DisplayInfoCell, FlagCell, FlagSetCell, SemVerCell, VersionConstraintCell, and OriginCell from parcel/commons.h so a default-constructed registry dispatches the aurimasniekis/cpp-commons vocabulary types out of the box.

Parameters
regRegistry to populate.

◆ register_primitives()

void parcel::register_primitives ( ParcelRegistry reg)
inline

Register every PrimitiveCell<T> into reg.

Parameters
regRegistry to populate.

◆ register_std()

void parcel::register_std ( ParcelRegistry reg)
inline

Register the std-adapter cells into reg.

Registers SystemTimePointCell, UnixMillisCell, DurationMsCell, and YmdCell from parcel/ext/chrono.h, and PathCell from parcel/ext/filesystem.h. (TimestampMsCell is an alias of UnixMillisCell and shares its kind id.)

Parameters
regRegistry to populate.

◆ register_typed_collections()

void parcel::register_typed_collections ( ParcelRegistry reg)
inline

Register TypedListCell<P>, TypedMapCell<P>, and TypedHashMapCell<P> for every primitive P.

Each instantiation has a distinct kind id (e.g. "l:i32", "m:string", "hm:i32"), so the registry can dispatch any typed primitive collection without ambiguity.

Parameters
regRegistry to populate.