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
Public Member Functions | Protected Attributes | List of all members
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 | 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)
| Get column size.
int32_t | depth (flecs::entity_t rel)
| Get depth for given relationship.
template<typename Rel >
int32_t | depth ()
| Get depth for given relationship.
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

## ◆ 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 105 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 134 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 114 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 124 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 95 of file table.hpp.

## ◆ column_size()

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

Get column size.

Definition at line 276 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 | ( |  | ) |
| inline

Get depth for given relationship.

Template Parameters

  Rel | The relationship.

Returns
  The depth.

Definition at line 295 of file table.hpp.

## ◆ depth() [2/2]

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

Get depth for given relationship.

Parameters

  rel | The relationship.

Returns
  The depth.

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

  T | The component.

Returns
  Pointer to the column, NULL if not found.

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

  T | The (enum) component.

Returns
  Pointer to the column, NULL if not found.

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

  T | The component.

Returns
  Pointer to the column, NULL if not found.

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

  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 271 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

  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 217 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

  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 259 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

  id | The component id.

Returns
  Pointer to the column, NULL if not found.

Definition at line 203 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 194 of file table.hpp.

## ◆ get_table()

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

Get table.

Returns
  The table.

Definition at line 303 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 153 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 185 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 163 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 174 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 143 of file table.hpp.

## ◆ operator table_t *()

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

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

  T | The type.

Returns
  True if the table has the type, false if not.

Definition at line 57 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 86 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 66 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 76 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 47 of file table.hpp.

## Member Data Documentation

## ◆ table_

table_t* flecs::table::table_
| protected

Definition at line 314 of file table.hpp.

## ◆ world_

world_t* flecs::table::world_
| protected

Definition at line 313 of file table.hpp.

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

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