51#include <commons/json/lifecycle.hpp>
52#include <commons/lifecycle.hpp>
73 using base_t::operator=;
75 static constexpr std::string_view kind_id =
"lifecycle_status";
77 [[nodiscard]] std::string
to_string()
const override {
78 return this->
value.name();
85 static cell_type_descriptor_t descriptor() {
86 static const auto d = std::make_shared<SimpleCellTypeDescriptor<LifecycleStatusCell>>(
87 DisplayInfo{.name =
"LifecycleStatus",
88 .description =
"Lifecycle status (string name on the wire)"});
101template <CellLike P = LifecycleStatusCell>
103 :
public BaseCell<StatusTransitionCell<P>, comms::StatusTransition<typename P::storage_t>> {
106 [[nodiscard]]
static std::string render(
const typename P::storage_t& s) {
111 using element_type = P;
113 using base_t::base_t;
114 using base_t::operator=;
116 static constexpr std::string_view kind_id =
prefixed_id_v<
"status_transition:", P::kind_id>;
119 return this->
value.previous
120 ? render(*this->
value.previous) +
" \xe2\x86\x92 " + render(this->
value.status)
121 : render(this->
value.status);
128 static cell_type_descriptor_t descriptor() {
129 static const auto d = std::make_shared<SimpleCellTypeDescriptor<StatusTransitionCell>>(
130 DisplayInfo{.name =
"StatusTransition",
131 .description = std::string(
"Lifecycle transition event (status of ") +
132 std::string(P::kind_id) +
")"});
144template <CellLike P = LifecycleStatusCell>
146 :
public BaseCell<StatusReportCell<P>, comms::StatusReport<typename P::storage_t>> {
150 using element_type = P;
152 using base_t::base_t;
153 using base_t::operator=;
155 static constexpr std::string_view kind_id =
prefixed_id_v<
"status_report:", P::kind_id>;
158 return P{this->
value.status}.to_string();
165 static cell_type_descriptor_t descriptor() {
166 static const auto d = std::make_shared<SimpleCellTypeDescriptor<StatusReportCell>>(
167 DisplayInfo{.name =
"StatusReport",
168 .description = std::string(
"Per-status period summary (status of ") +
169 std::string(P::kind_id) +
")"});
187template <CellLike P = LifecycleStatusCell>
189 :
public BaseCell<StatusTransitionTimelineCell<P>,
190 std::vector<comms::StatusTransition<typename P::storage_t>>> {
192 std::vector<comms::StatusTransition<typename P::storage_t>>>;
195 using element_type = P;
201 using timeline_t = comms::StatusTransitionTimeline<status_t>;
203 using base_t::base_t;
204 using base_t::operator=;
209 static constexpr std::string_view kind_id =
219 tl.load_transitions(this->
value);
223 return "[" + std::to_string(this->
value.size()) +
" status transitions]";
228 [[nodiscard]] std::partial_ordering
compare(
ICell const& other)
const override {
229 if (
const auto k = this->
kind() <=> other.
kind(); k != 0) {
234 return std::partial_ordering::unordered;
236 return this->
value == o->
value ? std::partial_ordering::equivalent
237 : std::partial_ordering::unordered;
244 static cell_type_descriptor_t descriptor() {
245 static const auto d =
246 std::make_shared<SimpleCellTypeDescriptor<StatusTransitionTimelineCell>>(
247 DisplayInfo{.name =
"StatusTransitionTimeline",
248 .description = std::string(
"Lifecycle transition history (status of ") +
249 std::string(P::kind_id) +
")"});
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
Cell wrapping comms::LifecycleStatus.
Definition lifecycle.h:68
std::string to_string() const override
Render the cell's value as a compact human-readable string.
Definition lifecycle.h:77
Runtime catalog of cell-type descriptors, keyed by wire kind id.
Definition registry.h:115
Cell wrapping comms::StatusReport<typename P::storage_t>, a per-status period summary.
Definition lifecycle.h:146
std::string to_string() const override
Render the cell's value as a compact human-readable string.
Definition lifecycle.h:157
Cell wrapping comms::StatusTransition<typename P::storage_t>, a single transition event.
Definition lifecycle.h:103
std::string to_string() const override
Render the cell's value as a compact human-readable string.
Definition lifecycle.h:118
Cell carrying the serializable history of a comms::StatusTransitionTimeline<typename P::storage_t>.
Definition lifecycle.h:190
void load_into(timeline_t &tl) const
Restore the stored history into a live timeline via load_transitions (no replay — subscribers are not...
Definition lifecycle.h:218
typename P::storage_t status_t
The status type carried by each transition.
Definition lifecycle.h:197
comms::StatusTransition< status_t > transition_t
The element type of the stored history.
Definition lifecycle.h:199
std::partial_ordering compare(ICell const &other) const override
Default three-way comparison: kind first, then storage value.
Definition lifecycle.h:228
StatusTransitionTimelineCell(const timeline_t &tl)
Snapshot a live timeline's transition history into the cell.
Definition lifecycle.h:207
comms::StatusTransitionTimeline< status_t > timeline_t
The live timeline type this cell projects.
Definition lifecycle.h:201
std::string to_string() const override
Render the cell's value as a compact human-readable string.
Definition lifecycle.h:222
The shared vocabulary aliases re-exported from commons and the compile-time kind-id machinery.
constexpr std::string_view prefixed_id_v
Convenience alias yielding the joined std::string_view.
Definition common.h:175
The default_cell_for<T> trait that drives FieldsBuilder field-type inference.
#define PARCEL_DEFAULT_CELL(CellT)
Register a cell type as the default wrapper for its payload type.
Definition defaults.h:269
Runtime cell-type descriptors and the schema-graph mix-ins (IHasFields, ISubTypes).
nlohmann::json typedef shared across cell types.
nlohmann::json json_t
Project-wide alias for nlohmann::json.
Definition json.h:19
CRTP base providing default to_json / clone / kind plumbing on top of a storage type.
Definition cell.h:343
static cell_t from_json_strict(json_t const &j)
Strict shorthand for the recurring cell_from_json + make_shared.
Definition cell.h:571
std::string_view kind() const override
Wire-stable kind identifier for this cell.
Definition cell.h:411
comms::LifecycleStatus value
Held value of the cell.
Definition cell.h:348
Polymorphic root of every parcel cell.
Definition cell.h:84
virtual std::string to_string() const =0
Render the cell's value as a compact human-readable string.
virtual std::string_view kind() const =0
Wire-stable kind identifier for this cell.