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

Untyped component reference. More...

#include <ref.hpp>

Inheritance diagram for flecs::untyped_ref:
[legend]

Public Member Functions

 untyped_ref ()
 Default constructor.
 
 untyped_ref (world_t *world, entity_t entity, flecs::id_t id)
 Construct a reference from a world, entity, and component ID.
 
 untyped_ref (flecs::entity entity, flecs::id_t id)
 Construct a reference from an entity and component ID.
 
flecs::entity entity () const
 Return the entity associated with the reference.
 
flecs::id component () const
 Return the component associated with the reference.
 
void * get ()
 Get a pointer to the component value.
 
bool has ()
 Check if the reference has a valid component value.
 
flecs::world world () const
 Get the world associated with the reference.
 
 operator bool ()
 Implicit conversion to bool.
 
void * try_get ()
 Try to get a pointer to the component value.
 

Detailed Description

Untyped component reference.

Reference to a component from a specific entity.

Definition at line 22 of file ref.hpp.

Constructor & Destructor Documentation

◆ untyped_ref() [1/3]

flecs::untyped_ref::untyped_ref ( )
inline

Default constructor.

Creates an empty reference.

Definition at line 25 of file ref.hpp.

◆ untyped_ref() [2/3]

flecs::untyped_ref::untyped_ref ( world_t * world,
entity_t entity,
flecs::id_t id )
inline

Construct a reference from a world, entity, and component ID.

Parameters
worldThe world.
entityThe entity.
idThe component ID.

Definition at line 33 of file ref.hpp.

◆ untyped_ref() [3/3]

flecs::untyped_ref::untyped_ref ( flecs::entity entity,
flecs::id_t id )
inline

Construct a reference from an entity and component ID.

Parameters
entityThe entity.
idThe component ID.

Definition at line 10 of file impl.hpp.

Member Function Documentation

◆ component()

flecs::id flecs::untyped_ref::component ( ) const
inline

Return the component associated with the reference.

Definition at line 62 of file ref.hpp.

◆ entity()

flecs::entity flecs::untyped_ref::entity ( ) const
inline

Return the entity associated with the reference.

Definition at line 13 of file impl.hpp.

◆ get()

void * flecs::untyped_ref::get ( )
inline

Get a pointer to the component value.

Definition at line 67 of file ref.hpp.

◆ has()

bool flecs::untyped_ref::has ( )
inline

Check if the reference has a valid component value.

Definition at line 72 of file ref.hpp.

◆ operator bool()

flecs::untyped_ref::operator bool ( )
inline

Implicit conversion to bool.

Return true if there is a valid component instance being referred to.

Definition at line 84 of file ref.hpp.

◆ try_get()

void * flecs::untyped_ref::try_get ( )
inline

Try to get a pointer to the component value.

Return nullptr if the reference is invalid.

Definition at line 91 of file ref.hpp.

◆ world()

flecs::world flecs::untyped_ref::world ( ) const
inline

Get the world associated with the reference.

Definition at line 77 of file ref.hpp.


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