Flecs v4.1
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
flecs::id Struct Reference

Class that wraps around a flecs::id_t. More...

#include <decl.hpp>

Inheritance diagram for flecs::id:
[legend]

Public Member Functions

 id (flecs::id_t value)
 
 id (flecs::world_t *world, flecs::id_t value=0)
 
 id (flecs::world_t *world, flecs::id_t first, flecs::id_t second)
 
 id (flecs::world_t *world, const char *expr)
 
 id (flecs::id_t first, flecs::id_t second)
 
 id (const flecs::id &first, const flecs::id &second)
 
bool is_pair () const
 Test if ID is a pair (has first, second).
 
bool is_wildcard () const
 Test if ID is a wildcard.
 
bool is_entity () const
 Test if ID is an entity.
 
flecs::entity entity () const
 Return ID as entity (only allowed when ID is a valid entity).
 
flecs::entity add_flags (flecs::id_t flags) const
 Return ID with flags added.
 
flecs::entity remove_flags (flecs::id_t flags) const
 Return ID with flags removed.
 
flecs::entity remove_flags () const
 Return ID without flags.
 
flecs::entity remove_generation () const
 Return ID without generation.
 
flecs::entity type_id () const
 Return component type of ID.
 
bool has_flags (flecs::id_t flags) const
 Test if ID has specified flags.
 
bool has_flags () const
 Test if ID has any flags.
 
flecs::entity flags () const
 Return ID flags set on ID.
 
bool has_relation (flecs::id_t first) const
 Test if ID has the specified first element.
 
flecs::entity first () const
 Get first element from a pair.
 
flecs::entity second () const
 Get second element from a pair.
 
flecs::string str () const
 Convert ID to string.
 
flecs::string flags_str () const
 Convert flags of ID to string.
 
flecs::id_t raw_id () const
 Return flecs::id_t value.
 
 operator flecs::id_t () const
 
flecs::world world () const
 Get the world.
 

Protected Attributes

flecs::world_tworld_
 World is optional, but guarantees that entity identifiers extracted from the ID are valid.
 
flecs::id_t id_
 The raw ID value.
 

Detailed Description

Class that wraps around a flecs::id_t.

A flecs ID is an identifier that can be added to entities. IDs can be:

  • entities (including components, tags)
  • pair IDs
  • entities with ID flags set (like flecs::AUTO_OVERRIDE, flecs::TOGGLE)

Definition at line 27 of file decl.hpp.

Constructor & Destructor Documentation

◆ id() [1/7]

flecs::id::id ( )
inline

Definition at line 28 of file decl.hpp.

◆ id() [2/7]

flecs::id::id ( flecs::id_t value)
inlineexplicit

Definition at line 32 of file decl.hpp.

◆ id() [3/7]

flecs::id::id ( flecs::world_t * world,
flecs::id_t value = 0 )
inlineexplicit

Definition at line 36 of file decl.hpp.

◆ id() [4/7]

flecs::id::id ( flecs::world_t * world,
flecs::id_t first,
flecs::id_t second )
inlineexplicit

Definition at line 40 of file decl.hpp.

◆ id() [5/7]

flecs::id::id ( flecs::world_t * world,
const char * expr )
inlineexplicit

Definition at line 44 of file decl.hpp.

◆ id() [6/7]

flecs::id::id ( flecs::id_t first,
flecs::id_t second )
inlineexplicit

Definition at line 48 of file decl.hpp.

◆ id() [7/7]

flecs::id::id ( const flecs::id & first,
const flecs::id & second )
inlineexplicit

Definition at line 52 of file decl.hpp.

Member Function Documentation

◆ add_flags()

flecs::entity flecs::id::add_flags ( flecs::id_t flags) const
inline

Return ID with flags added.

Definition at line 40 of file impl.hpp.

◆ entity()

flecs::entity flecs::id::entity ( ) const
inline

Return ID as entity (only allowed when ID is a valid entity).

Definition at line 10 of file impl.hpp.

◆ first()

flecs::entity flecs::id::first ( ) const
inline

Get first element from a pair.

If the ID is not a pair, this operation will fail. When the ID has a world, the operation will ensure that the returned ID has the correct generation count.

Definition at line 20 of file impl.hpp.

◆ flags()

flecs::entity flecs::id::flags ( ) const
inline

Return ID flags set on ID.

Definition at line 16 of file impl.hpp.

◆ flags_str()

flecs::string flecs::id::flags_str ( ) const
inline

Convert flags of ID to string.

Definition at line 128 of file decl.hpp.

◆ has_flags() [1/2]

bool flecs::id::has_flags ( ) const
inline

Test if ID has any flags.

Definition at line 95 of file decl.hpp.

◆ has_flags() [2/2]

bool flecs::id::has_flags ( flecs::id_t flags) const
inline

Test if ID has specified flags.

Definition at line 90 of file decl.hpp.

◆ has_relation()

bool flecs::id::has_relation ( flecs::id_t first) const
inline

Test if ID has the specified first element.

Definition at line 103 of file decl.hpp.

◆ is_entity()

bool flecs::id::is_entity ( ) const
inline

Test if ID is an entity.

Definition at line 67 of file decl.hpp.

◆ is_pair()

bool flecs::id::is_pair ( ) const
inline

Test if ID is a pair (has first, second).

Definition at line 57 of file decl.hpp.

◆ is_wildcard()

bool flecs::id::is_wildcard ( ) const
inline

Test if ID is a wildcard.

Definition at line 62 of file decl.hpp.

◆ operator flecs::id_t()

flecs::id::operator flecs::id_t ( ) const
inline

Definition at line 137 of file decl.hpp.

◆ raw_id()

flecs::id_t flecs::id::raw_id ( ) const
inline

Return flecs::id_t value.

Definition at line 133 of file decl.hpp.

◆ remove_flags() [1/2]

flecs::entity flecs::id::remove_flags ( ) const
inline

Return ID without flags.

Definition at line 50 of file impl.hpp.

◆ remove_flags() [2/2]

flecs::entity flecs::id::remove_flags ( flecs::id_t flags) const
inline

Return ID with flags removed.

Definition at line 44 of file impl.hpp.

◆ remove_generation()

flecs::entity flecs::id::remove_generation ( ) const
inline

Return ID without generation.

Definition at line 54 of file impl.hpp.

◆ second()

flecs::entity flecs::id::second ( ) const
inline

Get second element from a pair.

If the ID is not a pair, this operation will fail. When the ID has a world, the operation will ensure that the returned ID has the correct generation count.

Definition at line 31 of file impl.hpp.

◆ str()

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

Convert ID to string.

Definition at line 123 of file decl.hpp.

◆ type_id()

flecs::entity flecs::id::type_id ( ) const
inline

Return component type of ID.

Definition at line 62 of file impl.hpp.

◆ world()

flecs::world flecs::id::world ( ) const
inline

Get the world.

Definition at line 58 of file impl.hpp.

Member Data Documentation

◆ id_

flecs::id_t flecs::id::id_
protected

The raw ID value.

Definition at line 149 of file decl.hpp.

◆ world_

flecs::world_t* flecs::id::world_
protected

World is optional, but guarantees that entity identifiers extracted from the ID are valid.

Definition at line 147 of file decl.hpp.


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