Gaia-ECS v1.0.0
A simple and powerful entity component system
Loading...
Searching...
No Matches
gaia::ecs::ComponentIndexEntryArray Class Reference

Small reverse-lookup bucket for entity-to-archetype matches. Most buckets contain one archetype, so keep that record inline and spill only when needed. More...

#include <query_common.h>

Public Types

using value_type = ComponentIndexEntry
 Stored reverse-index record type.
 
using size_type = uint32_t
 Unsigned element-count and index type.
 

Public Member Functions

 ComponentIndexEntryArray (ComponentIndexEntryArray &&) noexcept=default
 
 ComponentIndexEntryArray (const ComponentIndexEntryArray &)=default
 
ComponentIndexEntryArrayoperator= (ComponentIndexEntryArray &&) noexcept=default
 
ComponentIndexEntryArrayoperator= (const ComponentIndexEntryArray &)=default
 
GAIA_NODISCARD bool empty () const noexcept
 Checks whether the bucket contains no reverse-index records.
 
GAIA_NODISCARD size_type size () const noexcept
 Returns the number of reverse-index records.
 
GAIA_NODISCARD ComponentIndexEntrydata () noexcept
 Returns mutable contiguous record storage.
 
GAIA_NODISCARD const ComponentIndexEntrydata () const noexcept
 Returns read-only contiguous record storage.
 
GAIA_NODISCARD ComponentIndexEntrybegin () noexcept
 Returns a mutable iterator to the first record.
 
GAIA_NODISCARD const ComponentIndexEntrybegin () const noexcept
 Returns a read-only iterator to the first record.
 
GAIA_NODISCARD ComponentIndexEntryend () noexcept
 Returns a mutable iterator past the final record.
 
GAIA_NODISCARD const ComponentIndexEntryend () const noexcept
 Returns a read-only iterator past the final record.
 
GAIA_NODISCARD ComponentIndexEntryoperator[] (size_type idx) noexcept
 Returns a mutable record by index.
 
GAIA_NODISCARD const ComponentIndexEntryoperator[] (size_type idx) const noexcept
 Returns a read-only record by index.
 
GAIA_NODISCARD ComponentIndexEntryback () noexcept
 Returns the final mutable record.
 
GAIA_NODISCARD const ComponentIndexEntryback () const noexcept
 Returns the final read-only record.
 
void push_back (ComponentIndexEntry entry)
 Appends a reverse-index record, spilling inline storage when necessary.
 
void pop_back ()
 Removes the final record and restores inline storage when one record remains.
 

Detailed Description

Small reverse-lookup bucket for entity-to-archetype matches. Most buckets contain one archetype, so keep that record inline and spill only when needed.

Member Function Documentation

◆ back() [1/2]

GAIA_NODISCARD const ComponentIndexEntry & gaia::ecs::ComponentIndexEntryArray::back ( ) const
inlinenoexcept

Returns the final read-only record.

Returns
Last record in the non-empty bucket.

◆ back() [2/2]

GAIA_NODISCARD ComponentIndexEntry & gaia::ecs::ComponentIndexEntryArray::back ( )
inlinenoexcept

Returns the final mutable record.

Returns
Last record in the non-empty bucket.

◆ begin() [1/2]

GAIA_NODISCARD const ComponentIndexEntry * gaia::ecs::ComponentIndexEntryArray::begin ( ) const
inlinenoexcept

Returns a read-only iterator to the first record.

Returns
Pointer to the first stored record.

◆ begin() [2/2]

GAIA_NODISCARD ComponentIndexEntry * gaia::ecs::ComponentIndexEntryArray::begin ( )
inlinenoexcept

Returns a mutable iterator to the first record.

Returns
Pointer to the first stored record.

◆ data() [1/2]

GAIA_NODISCARD const ComponentIndexEntry * gaia::ecs::ComponentIndexEntryArray::data ( ) const
inlinenoexcept

Returns read-only contiguous record storage.

Returns
Pointer to the inline record or spill storage.

◆ data() [2/2]

GAIA_NODISCARD ComponentIndexEntry * gaia::ecs::ComponentIndexEntryArray::data ( )
inlinenoexcept

Returns mutable contiguous record storage.

Returns
Pointer to the inline record or spill storage.

◆ empty()

GAIA_NODISCARD bool gaia::ecs::ComponentIndexEntryArray::empty ( ) const
inlinenoexcept

Checks whether the bucket contains no reverse-index records.

Returns
True when size is zero.

◆ end() [1/2]

GAIA_NODISCARD const ComponentIndexEntry * gaia::ecs::ComponentIndexEntryArray::end ( ) const
inlinenoexcept

Returns a read-only iterator past the final record.

Returns
Pointer one past the last stored record.

◆ end() [2/2]

GAIA_NODISCARD ComponentIndexEntry * gaia::ecs::ComponentIndexEntryArray::end ( )
inlinenoexcept

Returns a mutable iterator past the final record.

Returns
Pointer one past the last stored record.

◆ operator[]() [1/2]

GAIA_NODISCARD const ComponentIndexEntry & gaia::ecs::ComponentIndexEntryArray::operator[] ( size_type  idx) const
inlinenoexcept

Returns a read-only record by index.

Parameters
idxZero-based record index.
Returns
Record at idx.

◆ operator[]() [2/2]

GAIA_NODISCARD ComponentIndexEntry & gaia::ecs::ComponentIndexEntryArray::operator[] ( size_type  idx)
inlinenoexcept

Returns a mutable record by index.

Parameters
idxZero-based record index.
Returns
Record at idx.

◆ push_back()

void gaia::ecs::ComponentIndexEntryArray::push_back ( ComponentIndexEntry  entry)
inline

Appends a reverse-index record, spilling inline storage when necessary.

Parameters
entryRecord to append.

◆ size()

GAIA_NODISCARD size_type gaia::ecs::ComponentIndexEntryArray::size ( ) const
inlinenoexcept

Returns the number of reverse-index records.

Returns
Number of stored records.

The documentation for this class was generated from the following file: