Flecs: flecs::table Struct Reference
Description: A fast entity component system (ECS) for C & C++

| Flecs v4.0 A fast entity component system (ECS) for C & C++

Loading...
Searching...
No Matches
flecs::table Struct Reference
C++ API » Core » Tables
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 * | try_get (flecs::id_t id) const
| Get pointer to component array by component.
void * | try_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 * | try_get () const
| Get pointer to component array by component.
template<typename T, typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>
A * | try_get () const
| Get pointer to component array by component.
template<typename First>
First * | try_get (flecs::entity_t second) const
| Get pointer to component array by pair.
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, 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

  T | The 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

  First | First element of pair.
  Second | Second 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

  first | First element of pair.
  second | Second 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

  First | First element of pair.

Parameters

  second | Second 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

  id | The (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 346 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

  Rel | The relationship.

Returns
  The depth.

Definition at line 365 of file table.hpp.

## ◆ depth() [2/2]

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

Get depth for given relationship.

Parameters

  rel | The relationship.

Returns
  The depth.

Definition at line 355 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/6]

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

  T | The component.

Returns
  Pointer to the column, NULL if not found.

Definition at line 306 of file table.hpp.

## ◆ get() [2/6]

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

  T | The component.

Returns
  Pointer to the column, NULL if not found.

Definition at line 317 of file table.hpp.

## ◆ get() [3/6]

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

  First | The first element of the pair.
  Second | The second element of the pair.

Returns
  Pointer to the column, NULL if not found.

Definition at line 341 of file table.hpp.

## ◆ get() [4/6]

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

Get pointer to component array by pair.

Parameters

  first | The first element of the pair.
  second | The second element of the pair.

Returns
  Pointer to the column, NULL if not found.

Definition at line 296 of file table.hpp.

## ◆ get() [5/6]

template<typename First>

First * flecs::table::get | ( | flecs::entity_t | second | ) | const
| inline

Get pointer to component array by pair.

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.

Returns
  Pointer to the column, NULL if not found.

Definition at line 328 of file table.hpp.

## ◆ get() [6/6]

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

Get pointer to component array by component.

Parameters

  id | The component id.

Returns
  Pointer to the column, NULL if not found.

Definition at line 279 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

  index | The 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 398 of file table.hpp.

## ◆ has() [1/5]

template<typename T>

bool flecs::table::has | ( |  | ) | const
| inline

Test if table has the type.

Template Parameters

  T | The 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

  First | First element of pair.
  Second | Second 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

  first | First element of pair.
  second | Second 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

  First | First element of pair.

Parameters

  second | Second 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

  id | The (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 390 of file table.hpp.

## ◆ id()

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

Get table id.

Definition at line 375 of file table.hpp.

## ◆ lock()

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

Lock table.

Definition at line 380 of file table.hpp.

## ◆ operator table_t *()

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

Definition at line 403 of file table.hpp.

## ◆ records()

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

Get table records array.

Definition at line 370 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.

## ◆ try_get() [1/5]

template<typename T, if_t< is_actual< T >::value > = 0>

T * flecs::table::try_get | ( |  | ) | const
| inline

Get pointer to component array by component.

Template Parameters

  T | The component.

Returns
  Pointer to the column, NULL if not found.

Definition at line 245 of file table.hpp.

## ◆ try_get() [2/5]

template<typename T, typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>

A * flecs::table::try_get | ( |  | ) | const
| inline

Get pointer to component array by component.

Template Parameters

  T | The component.

Returns
  Pointer to the column, NULL if not found.

Definition at line 256 of file table.hpp.

## ◆ try_get() [3/5]

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

Get pointer to component array by pair.

Parameters

  first | The first element of the pair.
  second | The second element of the pair.

Returns
  Pointer to the column, NULL if not found.

Definition at line 235 of file table.hpp.

## ◆ try_get() [4/5]

template<typename First>

First * flecs::table::try_get | ( | flecs::entity_t | second | ) | const
| inline

Get pointer to component array by pair.

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.

Returns
  Pointer to the column, NULL if not found.

Definition at line 267 of file table.hpp.

## ◆ try_get() [5/5]

void * flecs::table::try_get | ( | flecs::id_t | id | ) | const
| inline

Get pointer to component array by component.

Parameters

  id | The component id.

Returns
  Pointer to the column, NULL if not found.

Definition at line 221 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

  T | The 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

  First | First element of pair.
  Second | Second 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

  first | First element of pair.
  second | Second 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

  First | First element of pair.

Parameters

  second | Second 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

  id | The (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 385 of file table.hpp.

## Member Data Documentation

## ◆ table_

table_t* flecs::table::table_
| protected

Definition at line 409 of file table.hpp.

## ◆ world_

world_t* flecs::table::world_
| protected

Definition at line 408 of file table.hpp.

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

- include/flecs/addons/cpp/table.hpp