Engine → ECS → entity_archive.h
entity_archive
| Type | Class |
| Namespace | conjure::ecs |
| Include File Path | engine/include/conjure/ecs/entity_archive.h |
| Source File Path | engine/src/ecs/entity_archive.cpp |
| API ↗ | Archives and serialisation |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | explicit entity_archive(
const component_registry ®istry) noexcept; | An empty archive bound to a registry. |
| public | entity_archive(
entity_archive &&other) noexcept; |
Important
Copy constructor and assignment has been deleted.
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~entity_archive(); |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mEntries | std:: | {} | |
| private | mRegistry | const component_ | nullptr |
Functions
Public
capture
capture[[nodiscard]] static core::result<entity_archive> capture(
const world &source,
std::span<const entity> entities,
archive_options options = {});Copies the given entities (every non-TRANSIENT component through ops.copy) and rewrites their entity fields to local indices. ENTITY_NOT_ALIVE when an entity is dead; the world must be unlocked (STRUCTURE_LOCKED otherwise).
component_bytes
component_bytes[[nodiscard]] std::span<const std::byte> component_bytes(
u32 entryIndex,
component_id id) const noexcept;The component payload of one entry, or an empty span when absent (or a tag).
entries
entries[[nodiscard]] std::span<const archive_entry> entries() const noexcept;The entries in capture order (entry 0 is the root).
push_entry
push_entryvoid push_entry(
archive_entry entry);Appends an entry whose payloads are moved in (used by read_archive_json and tests). Payload bytes must be object images owned by the caller until this call.
registry
registry[[nodiscard]] const component_registry ®istry() const noexcept;The registry the component ids belong to.
validate
validate[[nodiscard]] core::result<void> validate() const;Checks that every component id is registered and non-tag payloads have the registered size, every mask bit has its component (and vice versa), and every archive-local entity reference points inside the archive. ARCHIVE_CORRUPT otherwise.
Private
destroy_payloads
destroy_payloadsvoid destroy_payloads() noexcept;Operator Overloads
Public
operator=
operator=entity_archive &operator=(
entity_archive &&other) noexcept;