#pragma once #include "evo/server/lifecycle/cellular_census.hpp" #include #include #include #include #include namespace evo::server { // A query/work bound, not a selected world size or proof of world completeness. inline constexpr std::size_t max_cellular_census_regions = 64; struct CellularCensusSetBoundary { std::uint64_t world{}, frame{}, tick{}; std::uint32_t owner_format{}, rules{}; std::uint64_t quantum_microseconds{biology::cellular_motion_tick_microseconds}; bool operator==(const CellularCensusSetBoundary&) const = default; }; enum class CellularCensusSetError : std::uint8_t { invalid_request, coverage, boundary, genome_conflict, resident_conflict }; // Detached observations of an explicitly declared region set. No branch, // commit, permission, ownership or globally complete reconciliation proof. class CellularCensusSet { public: // required_regions must be nonzero, strictly ascending and contain 1..64 IDs. // Exactly one observation per required region, at the exact common boundary. // Raw/cohort classification may differ; owner format/rules/quantum may not. [[nodiscard]] static std::expected observe(CellularCensusSetBoundary, std::span required_regions, std::span observations); [[nodiscard]] const CellularCensusSetBoundary& boundary() const noexcept { return boundary_; } // Sorted by region, owning detached copies. Lifetime: this object. [[nodiscard]] std::span regions() const noexcept { return regions_; } // Unknown everywhere is an error, never absence. An absent local anchor can // contribute zero only after the complete declared set has been validated. // Nonresident totals count historical record occurrences, not unique lives. [[nodiscard]] std::expected query(std::uint64_t anchor, CellularCensusScope scope) const; private: CellularCensusSet() = default; CellularCensusSetBoundary boundary_; std::vector regions_; }; } // namespace evo::server