Skip to content
Flecs v4.1

Table. More...

#include <table.hpp>

Public Member Functions

 table ()
 Default constructor.
 table (world_t *world, table_t *t)
 Construct a table from a world and C table pointer.
virtual ~table ()
 Destructor.
flecs::string str () const
 Convert the table type to a string.
flecs::type type () const
 Get the table type.
int32_t count () const
 Get the table count.
int32_t size () const
 Get the number of allocated elements in the table.
const flecs::entity_tentities () const
 Get the array of entity IDs.
void clear_entities () const
 Delete entities in the table.
template<typename... T, typename... Args>
int32_t type_index (Args... args) const
template<typename... T, typename... Args>
int32_t column_index (Args... args) const
template<typename... T, typename... Args>
bool has (Args... args) const
virtual void * get_column (int32_t index) const
 Get a pointer to the component array by column index.
template<typename... T, typename... Args>
auto try_get (Args... args) const
template<typename... T, typename... Args>
auto get (Args... args) const
size_t column_size (int32_t index) const
 Get the column size.
int32_t depth (flecs::entity_t rel) const
 Get the depth for a given relationship.
template<typename Rel>
int32_t depth () const
 Get the depth for a given relationship.
ecs_table_records_t records () const
 Get the table records array.
uint64_t id () const
 Get the table ID.
void lock () const
 Lock the table.
void unlock () const
 Unlock the table.
bool has_flags (ecs_flags32_t flags) const
 Check if the table has flags.
table_tget_table () const
 Get the table.
 operator table_t * () const
 Implicit conversion to table_t*.

Protected Attributes

world_tworld_
table_ttable_

Detailed Description

Table.

A table stores entities with the same set of components.

Definition at line 23 of file table.hpp.

Constructor & Destructor Documentation

◆ table() [1/2]

flecs::table::table ( )
inline

Default constructor.

Definition at line 25 of file table.hpp.

◆ table() [2/2]

flecs::table::table ( world_t * world,
table_t * t )
inline

Construct a table from a world and C table pointer.

Parameters
worldThe world.
tPointer to the C table.

Definition at line 32 of file table.hpp.

◆ ~table()

virtual flecs::table::~table ( )
inlinevirtual

Destructor.

Definition at line 37 of file table.hpp.

Member Function Documentation

◆ clear_entities()

void flecs::table::clear_entities ( ) const
inline

Delete entities in the table.

Definition at line 65 of file table.hpp.

◆ column_index()

template<typename... T, typename... Args>
int32_t flecs::table::column_index ( Args... args) const
inline

Definition at line 75 of file table.hpp.

◆ column_size()

size_t flecs::table::column_size ( int32_t index) const
inline

Get the column size.

Parameters
indexThe column index.
Returns
The size of the column's component type.

Definition at line 109 of file table.hpp.

◆ count()

int32_t flecs::table::count ( ) const
inline

Get the table count.

Definition at line 50 of file table.hpp.

◆ depth() [1/2]

template<typename Rel>
int32_t flecs::table::depth ( ) const
inline

Get the depth for a given relationship.

Template Parameters
RelThe relationship.
Returns
The depth.

Definition at line 128 of file table.hpp.

◆ depth() [2/2]

int32_t flecs::table::depth ( flecs::entity_t rel) const
inline

Get the depth for a given relationship.

Parameters
relThe relationship.
Returns
The depth.

Definition at line 118 of file table.hpp.

◆ entities()

const flecs::entity_t * flecs::table::entities ( ) const
inline

Get the array of entity IDs.

Definition at line 60 of file table.hpp.

◆ get()

template<typename... T, typename... Args>
auto flecs::table::get ( Args... args) const
inline

Definition at line 100 of file table.hpp.

◆ get_column()

virtual void * flecs::table::get_column ( int32_t index) const
inlinevirtual

Get a pointer to the component array by column index.

Parameters
indexThe column index.
Returns
Pointer to the column, nullptr if not a component.

Reimplemented in flecs::table_range.

Definition at line 89 of file table.hpp.

◆ get_table()

table_t * flecs::table::get_table ( ) const
inline

Get the table.

Returns
The table.

Definition at line 171 of file table.hpp.

◆ has()

template<typename... T, typename... Args>
bool flecs::table::has ( Args... args) const
inline

Definition at line 80 of file table.hpp.

◆ has_flags()

bool flecs::table::has_flags ( ecs_flags32_t flags) const
inline

Check if the table has flags.

Parameters
flagsThe flags to check for.
Returns
True if the table has the specified flags.

Definition at line 163 of file table.hpp.

◆ id()

uint64_t flecs::table::id ( ) const
inline

Get the table ID.

Returns
The table ID.

Definition at line 144 of file table.hpp.

◆ lock()

void flecs::table::lock ( ) const
inline

Lock the table.

Definition at line 149 of file table.hpp.

◆ operator table_t *()

flecs::table::operator table_t * ( ) const
inline

Implicit conversion to table_t*.

Definition at line 176 of file table.hpp.

◆ records()

ecs_table_records_t flecs::table::records ( ) const
inline

Get the table records array.

Returns
The table records.

Definition at line 136 of file table.hpp.

◆ size()

int32_t flecs::table::size ( ) const
inline

Get the number of allocated elements in the table.

Definition at line 55 of file table.hpp.

◆ str()

flecs::string flecs::table::str ( ) const
inline

Convert the table type to a string.

Definition at line 40 of file table.hpp.

◆ try_get()

template<typename... T, typename... Args>
auto flecs::table::try_get ( Args... args) const
inline

Definition at line 95 of file table.hpp.

◆ type()

flecs::type flecs::table::type ( ) const
inline

Get the table type.

Definition at line 45 of file table.hpp.

◆ type_index()

template<typename... T, typename... Args>
int32_t flecs::table::type_index ( Args... args) const
inline

Definition at line 70 of file table.hpp.

◆ unlock()

void flecs::table::unlock ( ) const
inline

Unlock the table.

Definition at line 154 of file table.hpp.

Member Data Documentation

◆ table_

table_t* flecs::table::table_
protected

Definition at line 197 of file table.hpp.

◆ world_

world_t* flecs::table::world_
protected

Definition at line 196 of file table.hpp.


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