Flecs v4.0
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
flecs::table Struct Reference
Inheritance diagram for flecs::table:
[legend]

Public Member Functions

 table (world_t *world, table_t *t)
 
flecs::string str () const
 Convert table type to string.
 
flecs::type type () const
 Get table type.
 
int32_t count () const
 Get table count.
 
int32_t size () const
 Get number of allocated elements in table.
 
const flecs::entity_t * entities () const
 Get array with entity ids.
 
void clear_entities () const
 Delete entities in table.
 
int32_t type_index (flecs::id_t id) const
 Find type index for (component) id.
 
template<typename T >
int32_t type_index () const
 Find type index for type.
 
int32_t type_index (flecs::entity_t first, flecs::entity_t second) const
 Find type index for pair.
 
template<typename First >
int32_t type_index (flecs::entity_t second) const
 Find type index for pair.
 
template<typename First , typename Second >
int32_t type_index () const
 Find type index for pair.
 
int32_t column_index (flecs::id_t id) const
 Find column index for (component) id.
 
template<typename T >
int32_t column_index () const
 Find column index for type.
 
int32_t column_index (flecs::entity_t first, flecs::entity_t second) const
 Find column index for pair.
 
template<typename First >
int32_t column_index (flecs::entity_t second) const
 Find column index for pair.
 
template<typename First , typename Second >
int32_t column_index () const
 Find column index for pair.
 
bool has (flecs::id_t id) const
 Test if table has (component) id.
 
template<typename T >
bool has () const
 Test if table has the type.
 
bool has (flecs::entity_t first, flecs::entity_t second) const
 Test if table has the pair.
 
template<typename First >
bool has (flecs::entity_t second) const
 Test if table has the pair.
 
template<typename First , typename Second >
bool has () const
 Test if table has the pair.
 
virtual void * get_column (int32_t index) const
 Get pointer to component array by column index.
 
void * get (flecs::id_t id) const
 Get pointer to component array by component.
 
void * get (flecs::entity_t first, flecs::entity_t second) const
 Get pointer to component array by pair.
 
template<typename T , if_t< is_actual< T >::value > = 0>
T * get () const
 Get pointer to component array by component.
 
template<typename T , if_t< is_enum< T >::value > = 0>
T * get () const
 Get pointer to component array by (enum) component.
 
template<typename T , typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>
A * get () const
 Get pointer to component array by component.
 
template<typename First >
First * get (flecs::entity_t second) const
 Get pointer to component array by pair.
 
template<typename First , typename Second , typename P = flecs::pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>
A * get () const
 Get pointer to component array by pair.
 
size_t column_size (int32_t index) const
 Get column size.
 
int32_t depth (flecs::entity_t rel) const
 Get depth for given relationship.
 
template<typename Rel >
int32_t depth () const
 Get depth for given relationship.
 
ecs_table_records_t records () const
 Get table records array.
 
uint64_t id () const
 Get table id.
 
void lock () const
 Lock table.
 
void unlock () const
 Unlock table.
 
bool has_flags (ecs_flags32_t flags) const
 Check if table has flags.
 
table_t * get_table () const
 Get table.
 
 operator table_t * () const
 

Protected Attributes

world_t * world_
 
table_t * table_
 

Detailed Description

Definition at line 18 of file table.hpp.

Constructor & Destructor Documentation

◆ table() [1/2]

flecs::table::table ( )
inline

Definition at line 19 of file table.hpp.

◆ table() [2/2]

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

Definition at line 21 of file table.hpp.

◆ ~table()

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

Definition at line 25 of file table.hpp.

Member Function Documentation

◆ clear_entities()

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

Delete entities in table.

Definition at line 53 of file table.hpp.

◆ column_index() [1/5]

template<typename T >
int32_t flecs::table::column_index ( ) const
inline

Find column index for type.

Template Parameters
TThe type.
Returns
True if the table has the type, false if not.

Definition at line 120 of file table.hpp.

◆ column_index() [2/5]

template<typename First , typename Second >
int32_t flecs::table::column_index ( ) const
inline

Find column index for pair.

Template Parameters
FirstFirst element of pair.
SecondSecond element of pair.
Returns
True if the table has the pair, false if not.

Definition at line 149 of file table.hpp.

◆ column_index() [3/5]

int32_t flecs::table::column_index ( flecs::entity_t first,
flecs::entity_t second ) const
inline

Find column index for pair.

Parameters
firstFirst element of pair.
secondSecond element of pair.
Returns
True if the table has the pair, false if not.

Definition at line 129 of file table.hpp.

◆ column_index() [4/5]

template<typename First >
int32_t flecs::table::column_index ( flecs::entity_t second) const
inline

Find column index for pair.

Template Parameters
FirstFirst element of pair.
Parameters
secondSecond element of pair.
Returns
True if the table has the pair, false if not.

Definition at line 139 of file table.hpp.

◆ column_index() [5/5]

int32_t flecs::table::column_index ( flecs::id_t id) const
inline

Find column index for (component) id.

Parameters
idThe (component) id.
Returns
The index of the id in the table type, -1 if not found/

Definition at line 110 of file table.hpp.

◆ column_size()

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

Get column size.

Definition at line 291 of file table.hpp.

◆ count()

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

Get table count.

Definition at line 38 of file table.hpp.

◆ depth() [1/2]

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

Get depth for given relationship.

Template Parameters
RelThe relationship.
Returns
The depth.

Definition at line 310 of file table.hpp.

◆ depth() [2/2]

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

Get depth for given relationship.

Parameters
relThe relationship.
Returns
The depth.

Definition at line 300 of file table.hpp.

◆ entities()

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

Get array with entity ids.

Definition at line 48 of file table.hpp.

◆ get() [1/7]

template<typename T , if_t< is_actual< T >::value > = 0>
T * flecs::table::get ( ) const
inline

Get pointer to component array by component.

Template Parameters
TThe component.
Returns
Pointer to the column, NULL if not found.

Definition at line 242 of file table.hpp.

◆ get() [2/7]

template<typename T , if_t< is_enum< T >::value > = 0>
T * flecs::table::get ( ) const
inline

Get pointer to component array by (enum) component.

Template Parameters
TThe (enum) component.
Returns
Pointer to the column, NULL if not found.

Definition at line 252 of file table.hpp.

◆ get() [3/7]

template<typename T , typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>
A * flecs::table::get ( ) const
inline

Get pointer to component array by component.

Template Parameters
TThe component.
Returns
Pointer to the column, NULL if not found.

Definition at line 263 of file table.hpp.

◆ get() [4/7]

template<typename First , typename Second , typename P = flecs::pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>
A * flecs::table::get ( ) const
inline

Get pointer to component array by pair.

Template Parameters
FirstThe first element of the pair.
SecondThe second element of the pair.
Returns
Pointer to the column, NULL if not found.

Definition at line 286 of file table.hpp.

◆ get() [5/7]

void * flecs::table::get ( flecs::entity_t first,
flecs::entity_t second ) const
inline

Get pointer to component array by pair.

Parameters
firstThe first element of the pair.
secondThe second element of the pair.
Returns
Pointer to the column, NULL if not found.

Definition at line 232 of file table.hpp.

◆ get() [6/7]

template<typename First >
First * flecs::table::get ( flecs::entity_t second) const
inline

Get pointer to component array by pair.

Template Parameters
FirstThe first element of the pair.
Parameters
secondThe second element of the pair.
Returns
Pointer to the column, NULL if not found.

Definition at line 274 of file table.hpp.

◆ get() [7/7]

void * flecs::table::get ( flecs::id_t id) const
inline

Get pointer to component array by component.

Parameters
idThe component id.
Returns
Pointer to the column, NULL if not found.

Definition at line 218 of file table.hpp.

◆ get_column()

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

Get pointer to component array by column index.

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

Reimplemented in flecs::table_range.

Definition at line 209 of file table.hpp.

◆ get_table()

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

Get table.

Returns
The table.

Definition at line 343 of file table.hpp.

◆ has() [1/5]

template<typename T >
bool flecs::table::has ( ) const
inline

Test if table has the type.

Template Parameters
TThe type.
Returns
True if the table has the type, false if not.

Definition at line 168 of file table.hpp.

◆ has() [2/5]

template<typename First , typename Second >
bool flecs::table::has ( ) const
inline

Test if table has the pair.

Template Parameters
FirstFirst element of pair.
SecondSecond element of pair.
Returns
True if the table has the pair, false if not.

Definition at line 200 of file table.hpp.

◆ has() [3/5]

bool flecs::table::has ( flecs::entity_t first,
flecs::entity_t second ) const
inline

Test if table has the pair.

Parameters
firstFirst element of pair.
secondSecond element of pair.
Returns
True if the table has the pair, false if not.

Definition at line 178 of file table.hpp.

◆ has() [4/5]

template<typename First >
bool flecs::table::has ( flecs::entity_t second) const
inline

Test if table has the pair.

Template Parameters
FirstFirst element of pair.
Parameters
secondSecond element of pair.
Returns
True if the table has the pair, false if not.

Definition at line 189 of file table.hpp.

◆ has() [5/5]

bool flecs::table::has ( flecs::id_t id) const
inline

Test if table has (component) id.

Parameters
idThe (component) id.
Returns
True if the table has the id, false if not.

Definition at line 158 of file table.hpp.

◆ has_flags()

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

Check if table has flags.

Definition at line 335 of file table.hpp.

◆ id()

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

Get table id.

Definition at line 320 of file table.hpp.

◆ lock()

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

Lock table.

Definition at line 325 of file table.hpp.

◆ operator table_t *()

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

Definition at line 348 of file table.hpp.

◆ records()

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

Get table records array.

Definition at line 315 of file table.hpp.

◆ size()

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

Get number of allocated elements in table.

Definition at line 43 of file table.hpp.

◆ str()

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

Convert table type to string.

Definition at line 28 of file table.hpp.

◆ type()

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

Get table type.

Definition at line 33 of file table.hpp.

◆ type_index() [1/5]

template<typename T >
int32_t flecs::table::type_index ( ) const
inline

Find type index for type.

Template Parameters
TThe type.
Returns
True if the table has the type, false if not.

Definition at line 72 of file table.hpp.

◆ type_index() [2/5]

template<typename First , typename Second >
int32_t flecs::table::type_index ( ) const
inline

Find type index for pair.

Template Parameters
FirstFirst element of pair.
SecondSecond element of pair.
Returns
True if the table has the pair, false if not.

Definition at line 101 of file table.hpp.

◆ type_index() [3/5]

int32_t flecs::table::type_index ( flecs::entity_t first,
flecs::entity_t second ) const
inline

Find type index for pair.

Parameters
firstFirst element of pair.
secondSecond element of pair.
Returns
True if the table has the pair, false if not.

Definition at line 81 of file table.hpp.

◆ type_index() [4/5]

template<typename First >
int32_t flecs::table::type_index ( flecs::entity_t second) const
inline

Find type index for pair.

Template Parameters
FirstFirst element of pair.
Parameters
secondSecond element of pair.
Returns
True if the table has the pair, false if not.

Definition at line 91 of file table.hpp.

◆ type_index() [5/5]

int32_t flecs::table::type_index ( flecs::id_t id) const
inline

Find type index for (component) id.

Parameters
idThe (component) id.
Returns
The index of the id in the table type, -1 if not found/

Definition at line 62 of file table.hpp.

◆ unlock()

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

Unlock table.

Definition at line 330 of file table.hpp.

Member Data Documentation

◆ table_

table_t* flecs::table::table_
protected

Definition at line 354 of file table.hpp.

◆ world_

world_t* flecs::table::world_
protected

Definition at line 353 of file table.hpp.


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