Flecs v4.1
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
world.hpp File Reference

World class. More...

Include dependency graph for world.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  flecs::world
 The world. More...
 
struct  flecs::scoped_world
 Scoped world. More...
 

Functions

template<typename T >
void flecs::set (world_t *world, flecs::entity_t entity, T &&value, flecs::id_t id)
 Static helper functions to assign a component value.
 
template<typename T >
void flecs::set (world_t *world, flecs::entity_t entity, const T &value, flecs::id_t id)
 Set a component value using copy semantics.
 
template<typename T , typename A >
void flecs::set (world_t *world, entity_t entity, A &&value)
 Set a component value using move semantics, with automatic ID lookup.
 
template<typename T , typename A >
void flecs::set (world_t *world, entity_t entity, const A &value)
 Set a component value using copy semantics, with automatic ID lookup.
 
template<typename T >
void flecs::assign (world_t *world, flecs::entity_t entity, T &&value, flecs::id_t id)
 Assign a component value using move semantics.
 
template<typename T >
void flecs::assign (world_t *world, flecs::entity_t entity, const T &value, flecs::id_t id)
 Assign a component value using copy semantics.
 
template<typename T , typename A >
void flecs::assign (world_t *world, entity_t entity, A &&value)
 Assign a component value using move semantics, with automatic ID lookup.
 
template<typename T , typename A >
void flecs::assign (world_t *world, entity_t entity, const A &value)
 Assign a component value using copy semantics, with automatic ID lookup.
 
template<typename T , typename ... Args, if_t< std::is_constructible< actual_type_t< T >, Args... >::value||std::is_default_constructible< actual_type_t< T > >::value > = 0>
void flecs::emplace (world_t *world, flecs::entity_t entity, flecs::id_t id, Args &&... args)
 Emplace a component value, constructing it in place.
 
flecs::id_t flecs::strip_generation (flecs::entity_t e)
 Return the ID without generation.
 
uint32_t flecs::get_generation (flecs::entity_t e)
 Return the entity generation.
 

Detailed Description

World class.

Definition in file world.hpp.

Function Documentation

◆ assign() [1/4]

template<typename T , typename A >
void flecs::assign ( world_t * world,
entity_t entity,
A && value )
inline

Assign a component value using move semantics, with automatic ID lookup.

Template Parameters
TThe component type.
AThe actual value type.
Parameters
worldThe world.
entityThe entity.
valueThe value to assign (rvalue reference).

Definition at line 170 of file world.hpp.

◆ assign() [2/4]

template<typename T , typename A >
void flecs::assign ( world_t * world,
entity_t entity,
const A & value )
inline

Assign a component value using copy semantics, with automatic ID lookup.

Template Parameters
TThe component type.
AThe actual value type.
Parameters
worldThe world.
entityThe entity.
valueThe value to assign (const reference).

Definition at line 184 of file world.hpp.

◆ assign() [3/4]

template<typename T >
void flecs::assign ( world_t * world,
flecs::entity_t entity,
const T & value,
flecs::id_t id )
inline

Assign a component value using copy semantics.

Similar to set(), but uses ecs_cpp_assign() instead of ecs_cpp_set().

Template Parameters
TThe component type.
Parameters
worldThe world.
entityThe entity.
valueThe value to assign (const reference).
idThe component ID.

Definition at line 142 of file world.hpp.

◆ assign() [4/4]

template<typename T >
void flecs::assign ( world_t * world,
flecs::entity_t entity,
T && value,
flecs::id_t id )
inline

Assign a component value using move semantics.

Similar to set(), but uses ecs_cpp_assign() instead of ecs_cpp_set().

Template Parameters
TThe component type.
Parameters
worldThe world.
entityThe entity.
valueThe value to assign (rvalue reference).
idThe component ID.

Definition at line 109 of file world.hpp.

◆ emplace()

template<typename T , typename ... Args, if_t< std::is_constructible< actual_type_t< T >, Args... >::value||std::is_default_constructible< actual_type_t< T > >::value > = 0>
void flecs::emplace ( world_t * world,
flecs::entity_t entity,
flecs::id_t id,
Args &&... args )
inline

Emplace a component value, constructing it in place.

Template Parameters
TThe component type.
ArgsConstructor argument types.
Parameters
worldThe world.
entityThe entity.
idThe component ID.
argsConstructor arguments.

Definition at line 202 of file world.hpp.

◆ get_generation()

uint32_t flecs::get_generation ( flecs::entity_t e)
inline

Return the entity generation.

Parameters
eThe entity ID.
Returns
The generation of the entity.

Definition at line 228 of file world.hpp.

◆ set() [1/4]

template<typename T , typename A >
void flecs::set ( world_t * world,
entity_t entity,
A && value )
inline

Set a component value using move semantics, with automatic ID lookup.

Template Parameters
TThe component type.
AThe actual value type.
Parameters
worldThe world.
entityThe entity.
valueThe value to set (rvalue reference).

Definition at line 80 of file world.hpp.

◆ set() [2/4]

template<typename T , typename A >
void flecs::set ( world_t * world,
entity_t entity,
const A & value )
inline

Set a component value using copy semantics, with automatic ID lookup.

Template Parameters
TThe component type.
AThe actual value type.
Parameters
worldThe world.
entityThe entity.
valueThe value to set (const reference).

Definition at line 94 of file world.hpp.

◆ set() [3/4]

template<typename T >
void flecs::set ( world_t * world,
flecs::entity_t entity,
const T & value,
flecs::id_t id )
inline

Set a component value using copy semantics.

Template Parameters
TThe component type.
Parameters
worldThe world.
entityThe entity.
valueThe value to set (const reference).
idThe component ID.

Definition at line 53 of file world.hpp.

◆ set() [4/4]

template<typename T >
void flecs::set ( world_t * world,
flecs::entity_t entity,
T && value,
flecs::id_t id )
inline

Static helper functions to assign a component value.

Set a component value using move semantics.

Template Parameters
TThe component type.
Parameters
worldThe world.
entityThe entity.
valueThe value to set (rvalue reference).
idThe component ID.

Definition at line 22 of file world.hpp.

◆ strip_generation()

flecs::id_t flecs::strip_generation ( flecs::entity_t e)
inline

Return the ID without generation.

Parameters
eThe entity ID.
Returns
The entity ID without generation.
See also
ecs_strip_generation()

Definition at line 219 of file world.hpp.