Engine → ECS → chunk_view.h
chunk_view
| Type | Class |
| Namespace | conjure::ecs |
| Include File Path | engine/include/conjure/ecs/chunk_view.h |
| Source File Path | engine/src/ecs/chunk_view.cpp |
| API ↗ | Queries, views and systems |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | chunk_view() noexcept = default; | An invalid view: count() is 0 and every accessor returns empty. |
| public | chunk_view(
archetype &owner,
chunk &target,
u32 chunkIndex,
const component_registry ®istry,
u64 stampVersion,
const system_context *context) noexcept; | A view of one chunk. Built by queries and the world; context is the running system when the view was created through one (Debug access validation). |
| public | chunk_view(
const chunk_view &) noexcept = default; |
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~chunk_view() = default; |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mArchetype | archetype * | nullptr | |
| private | mChunk | chunk * | nullptr | |
| private | mChunkIndex | u32 | 0 | |
| private | mContext | [[maybe_ | nullptr | |
| private | mRegistry | const component_ | nullptr | |
| private | m | u64 | 0 |
Functions
Public
column_data
column_data[[nodiscard]] void *column_data(
component_id id,
bool forWrite) noexcept;Start of a component column, or nullptr for a tag or an absent component. forWrite stamps the column and, inside a system, checks the declared writes.
[[nodiscard]] const void *column_data(
component_id id) const noexcept;Read-only start of a component column, or nullptr. Never stamps.
column_stride
column_stride[[nodiscard]] u32 column_stride(
component_id id) const noexcept;Bytes between two rows of a column (the component size); 0 when absent.
column_version
column_version[[nodiscard]] u64 column_version(
component_id id) const noexcept;Version last stamped on a column; 0 when absent.
get
gettemplate <typename ComponentType> requires (!std::is_empty_v<std::remove_cv_t<ComponentType>>) [[nodiscard]] std::span<ComponentType> get() noexcept;The column of a required component: a non-const T stamps the column version once, a const T never does. A component the archetype lacks asserts and yields an empty span; use has() or get_optional() for optional components. A tag has no column and does not compile; test it with has().
get_optional
get_optionaltemplate <typename ComponentType> requires (!std::is_empty_v<std::remove_cv_t<ComponentType>>) [[nodiscard]] std::span<ComponentType> get_optional() noexcept;Like get(), but an absent component yields an empty span without asserting. A tag does not compile here either.
has
has[[nodiscard]] bool has(
component_id id) const noexcept;True when the archetype holds id (tags included).
is_valid
is_valid[[nodiscard]] bool is_valid() const noexcept;False for a default-constructed view.
owner
owner[[nodiscard]] const archetype *owner() const noexcept;The archetype this chunk belongs to (nullptr for an invalid view).
stamp_version
stamp_version[[nodiscard]] u64 stamp_version() const noexcept;The version non-const access stamps.
Operator Overloads
Public
operator=
operator=chunk_view &operator=(
const chunk_view &) noexcept = default;