Flecs: flecs::id 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::id Struct Reference
C++ API » Core » Ids

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 pair (has first, second)
bool | is_wildcard () const
| Test if id is a wildcard.
bool | is_entity () const
| Test if id is entity.
flecs::entity | entity () const
| Return id as entity (only allowed when id is valid entity)
flecs::entity | add_flags (flecs::id_t flags) const
| Return id with role added.
flecs::entity | remove_flags (flecs::id_t flags) const
| Return id with role removed.
flecs::entity | remove_flags () const
| Return id without role.
flecs::entity | remove_generation () const
| Return id without role.
flecs::entity | type_id () const
| Return component type of id.
bool | has_flags (flecs::id_t flags) const
| Test if id has specified role.
bool | has_flags () const
| Test if id has any role.
flecs::entity | flags () const
| Return id flags set on id.
bool | has_relation (flecs::id_t first) const
| Test if id has specified first.
flecs::entity | first () const
| Get first element from a pair.
flecs::entity | second () const
| Get second element from a pair.
flecs::string | str () const
flecs::string | flags_str () const
| Convert role of id to string.
flecs::id_t | raw_id () const
| Return flecs::id_t value.
| operator flecs::id_t () const
flecs::world | world () const

## Protected Attributes
flecs::world_t * | world_
flecs::id_t | id_

## 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 role 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 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 role 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 role.

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 role.

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 specified first.

Definition at line 103 of file decl.hpp.

## ◆ is_entity()

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

Test if id is entity.

Definition at line 67 of file decl.hpp.

## ◆ is_pair()

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

Test if id is 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 role.

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 role removed.

Definition at line 44 of file impl.hpp.

## ◆ remove_generation()

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

Return id without role.

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

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

Definition at line 58 of file impl.hpp.

## Member Data Documentation

## ◆ id_

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

Definition at line 147 of file decl.hpp.

## ◆ world_

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

Definition at line 146 of file decl.hpp.

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

- include/flecs/addons/cpp/mixins/id/decl.hpp
- include/flecs/addons/cpp/mixins/id/impl.hpp