Flecs v3.2
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
flecs::scoped_world Struct Reference

Scoped world. More...

#include <world.hpp>

Inheritance diagram for flecs::scoped_world:
[legend]

Public Member Functions

 scoped_world (flecs::world_t *w, flecs::entity_t s)
 
 scoped_world (const scoped_world &obj)
 
- Public Member Functions inherited from flecs::world
 world ()
 Create world.
 
 world (int argc, char *argv[])
 Create world with command line arguments.
 
 world (world_t *w)
 Create world from C world.
 
 world (const world &obj)=delete
 Not allowed to copy a world.
 
 world (world &&obj) noexcept
 
 operator world_t * () const
 
worldoperator= (const world &obj)=delete
 Not allowed to copy a world.
 
worldoperator= (world &&obj) noexcept
 
void reset ()
 Deletes and recreates the world.
 
world_t * c_ptr () const
 Obtain pointer to C world object.
 
void quit () const
 Signal application should quit.
 
void atfini (ecs_fini_action_t action, void *ctx=nullptr) const
 Register action to be executed when world is destroyed.
 
bool should_quit () const
 Test if quit() has been called.
 
ecs_ftime_t frame_begin (float delta_time=0) const
 Begin frame.
 
void frame_end () const
 End frame.
 
bool readonly_begin (bool multi_threaded=false) const
 Begin readonly mode.
 
void readonly_end () const
 End readonly mode.
 
bool defer_begin () const
 Defer operations until end of frame.
 
bool defer_end () const
 End block of operations to defer.
 
bool is_deferred () const
 Test whether deferring is enabled.
 
void set_stage_count (int32_t stages) const
 Configure world to have N stages.
 
int32_t get_stage_count () const
 Get number of configured stages.
 
int32_t get_stage_id () const
 Get current stage id.
 
bool is_stage () const
 Test if is a stage.
 
void set_automerge (bool automerge) const
 Enable/disable auto-merging for world or stage.
 
void merge () const
 Merge world or stage.
 
flecs::world get_stage (int32_t stage_id) const
 Get stage-specific world pointer.
 
flecs::world async_stage () const
 Create asynchronous stage.
 
flecs::world get_world () const
 Get actual world.
 
bool is_readonly () const
 Test whether the current world object is readonly.
 
void set_ctx (void *ctx, ecs_ctx_free_t ctx_free=nullptr) const
 Set world context.
 
void * get_ctx () const
 Get world context.
 
void set_binding_ctx (void *ctx, ecs_ctx_free_t ctx_free=nullptr) const
 Set world binding context.
 
void * get_binding_ctx () const
 Get world binding context.
 
void dim (int32_t entity_count) const
 Preallocate memory for number of entities.
 
void set_entity_range (entity_t min, entity_t max) const
 Set entity range.
 
void enable_range_check (bool enabled) const
 Enforce that operations cannot modify entities outside of range.
 
flecs::entity set_scope (const flecs::entity_t scope) const
 Set current scope.
 
flecs::entity get_scope () const
 Get current scope.
 
template<typename T >
flecs::entity set_scope () const
 Same as set_scope but with type.
 
flecs::entity_t * set_lookup_path (const flecs::entity_t *search_path) const
 Set search path.
 
flecs::entity lookup (const char *name, bool search_path=true) const
 Lookup entity by name.
 
template<typename T , if_t< !is_callable< T >::value > = 0>
void set (const T &value) const
 Set singleton component.
 
template<typename T , if_t< !is_callable< T >::value > = 0>
void set (T &&value) const
 Set singleton component.
 
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>
void set (const A &value) const
 Set singleton 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>
void set (A &&value) const
 Set singleton pair.
 
template<typename First , typename Second >
void set (Second second, const First &value) const
 Set singleton pair.
 
template<typename First , typename Second >
void set (Second second, First &&value) const
 Set singleton pair.
 
template<typename Func , if_t< is_callable< Func >::value > = 0>
void set (const Func &func) const
 Set singleton component inside a callback.
 
template<typename T , typename ... Args>
void emplace (Args &&... args) const
 
template<typename T >
T & ensure () const
 Ensure singleton component.
 
template<typename T >
void modified () const
 Mark singleton component as modified.
 
template<typename T >
ref< T > get_ref () const
 Get ref singleton component.
 
template<typename T >
const T * get () const
 Get singleton component.
 
template<typename First , typename Second , typename P = flecs::pair<First, Second>, typename A = actual_type_t<P>>
const A * get () const
 Get singleton pair.
 
template<typename First , typename Second >
const First * get (Second second) const
 Get singleton pair.
 
template<typename Func , if_t< is_callable< Func >::value > = 0>
void get (const Func &func) const
 Get singleton component inside a callback.
 
template<typename T >
T * get_mut () const
 Get mutable singleton component.
 
template<typename First , typename Second , typename P = flecs::pair<First, Second>, typename A = actual_type_t<P>>
A * get_mut () const
 Get mutable singleton pair.
 
template<typename First , typename Second >
First * get_mut (Second second) const
 Get mutable singleton pair.
 
template<typename T >
bool has () const
 Test if world has singleton component.
 
template<typename First , typename Second >
bool has () const
 Test if world has the provided pair.
 
template<typename First >
bool has (flecs::id_t second) const
 Test if world has the provided pair.
 
bool has (flecs::id_t first, flecs::id_t second) const
 Test if world has the provided pair.
 
template<typename T >
void add () const
 Add singleton component.
 
template<typename First , typename Second >
void add () const
 Adds a pair to the singleton component.
 
template<typename First >
void add (flecs::entity_t second) const
 Adds a pair to the singleton component.
 
void add (flecs::entity_t first, flecs::entity_t second) const
 Adds a pair to the singleton entity.
 
template<typename T >
void remove () const
 Remove singleton component.
 
template<typename First , typename Second >
void remove () const
 Removes the pair singleton component.
 
template<typename First >
void remove (flecs::entity_t second) const
 Removes the pair singleton component.
 
void remove (flecs::entity_t first, flecs::entity_t second) const
 Removes the pair singleton component.
 
template<typename Func >
void children (Func &&f) const
 Iterate entities in root of world Accepts a callback with the following signature:
 
template<typename T >
flecs::entity singleton () const
 Get singleton entity for type.
 
template<typename First >
flecs::entity target (int32_t index=0) const
 Get target for a given pair from a singleton entity.
 
template<typename T >
flecs::entity target (flecs::entity_t first, int32_t index=0) const
 Get target for a given pair from a singleton entity.
 
flecs::entity target (flecs::entity_t first, int32_t index=0) const
 Get target for a given pair from a singleton entity.
 
template<typename T >
flecs::entity use (const char *alias=nullptr) const
 Create alias for component.
 
flecs::entity use (const char *name, const char *alias=nullptr) const
 Create alias for entity.
 
void use (flecs::entity entity, const char *alias=nullptr) const
 Create alias for entity.
 
int count (flecs::id_t component_id) const
 Count entities matching a component.
 
int count (flecs::entity_t first, flecs::entity_t second) const
 Count entities matching a pair.
 
template<typename T >
int count () const
 Count entities matching a component.
 
template<typename First >
int count (flecs::entity_t second) const
 Count entities matching a pair.
 
template<typename First , typename Second >
int count () const
 Count entities matching a pair.
 
template<typename Func >
void with (id_t with_id, const Func &func) const
 All entities created in function are created with id.
 
template<typename T , typename Func >
void with (const Func &func) const
 All entities created in function are created with type.
 
template<typename First , typename Second , typename Func >
void with (const Func &func) const
 All entities created in function are created with pair.
 
template<typename First , typename Func >
void with (id_t second, const Func &func) const
 All entities created in function are created with pair.
 
template<typename Func >
void with (id_t first, id_t second, const Func &func) const
 All entities created in function are created with pair.
 
template<typename Func >
void scope (id_t parent, const Func &func) const
 All entities created in function are created in scope.
 
template<typename T , typename Func >
void scope (const Func &func) const
 Same as scope(parent, func), but with T as parent.
 
flecs::scoped_world scope (id_t parent) const
 Use provided scope for operations ran on returned world.
 
template<typename T >
flecs::scoped_world scope () const
 
flecs::scoped_world scope (const char *name) const
 
void delete_with (id_t the_id) const
 Delete all entities with specified id.
 
void delete_with (entity_t first, entity_t second) const
 Delete all entities with specified pair.
 
template<typename T >
void delete_with () const
 Delete all entities with specified component.
 
template<typename First , typename Second >
void delete_with () const
 Delete all entities with specified pair.
 
template<typename First >
void delete_with (entity_t second) const
 Delete all entities with specified pair.
 
void remove_all (id_t the_id) const
 Remove all instances of specified id.
 
void remove_all (entity_t first, entity_t second) const
 Remove all instances of specified pair.
 
template<typename T >
void remove_all () const
 Remove all instances of specified component.
 
template<typename First , typename Second >
void remove_all () const
 Remove all instances of specified pair.
 
template<typename First >
void remove_all (entity_t second) const
 Remove all instances of specified pair.
 
template<typename Func >
void defer (const Func &func) const
 Defer all operations called in function.
 
void defer_suspend () const
 Suspend deferring operations.
 
void defer_resume () const
 Resume deferring operations.
 
bool exists (flecs::entity_t e) const
 Check if entity id exists in the world.
 
bool is_alive (flecs::entity_t e) const
 Check if entity id exists in the world.
 
bool is_valid (flecs::entity_t e) const
 Check if entity id is valid.
 
flecs::entity get_alive (flecs::entity_t e) const
 Get alive entity for id.
 
flecs::entity make_alive (flecs::entity_t e) const
 
void run_post_frame (ecs_fini_action_t action, void *ctx) const
 
const flecs::world_info_tget_info () const
 Get the world info.
 
ecs_ftime_t delta_time () const
 Get delta_time.
 
void init_builtin_components ()
 
template<typename... Comps, typename... Args>
flecs::alert_builder< Comps... > alert (Args &&... args) const
 Create alert.
 
template<typename T , typename... Args>
flecs::component< T > component (Args &&... args) const
 Find or register component.
 
template<typename... Args>
flecs::untyped_component component (Args &&... args) const
 Find or register untyped component.
 
template<typename... Args>
flecs::entity entity (Args &&... args) const
 Create an entity.
 
template<typename E , if_t< is_enum< E >::value > = 0>
flecs::id id (E value) const
 Convert enum constant to entity.
 
template<typename E , if_t< is_enum< E >::value > = 0>
flecs::entity entity (E value) const
 Convert enum constant to entity.
 
template<typename... Args>
flecs::entity prefab (Args &&... args) const
 Create a prefab.
 
template<typename T >
flecs::entity entity (const char *name=nullptr) const
 Create an entity that's associated with a type.
 
template<typename T >
flecs::entity prefab (const char *name=nullptr) const
 Create a prefab that's associated with a type.
 
template<typename E , if_t< is_enum< E >::value > = 0>
flecs::entity to_entity (E constant) const
 Convert enum constant to entity.
 
flecs::event_builder event (flecs::entity_t evt) const
 Create a new event.
 
template<typename E >
flecs::event_builder_typed< E > event () const
 Create a new event.
 
template<typename T >
flecs::id id () const
 
template<typename ... Args>
flecs::id id (Args &&... args) const
 
template<typename T >
flecs::id id () const
 Get id from a type.
 
template<typename ... Args>
flecs::id id (Args &&... args) const
 Id factory.
 
template<typename First , typename Second >
flecs::id pair () const
 Get pair id from relationship, object.
 
template<typename First >
flecs::id pair (entity_t o) const
 Get pair id from relationship, object.
 
flecs::id pair (entity_t r, entity_t o) const
 Get pair id from relationship, object.
 
flecs::string to_json (flecs::entity_t tid, const void *value)
 Serialize untyped value to JSON.
 
template<typename T >
flecs::string to_json (const T *value)
 Serialize value to JSON.
 
flecs::string to_json ()
 Serialize world to JSON.
 
const char * from_json (flecs::entity_t tid, void *value, const char *json, flecs::from_json_desc_t *desc=nullptr)
 Deserialize value from JSON.
 
template<typename T >
const char * from_json (T *value, const char *json, flecs::from_json_desc_t *desc=nullptr)
 Deserialize value from JSON.
 
const char * from_json (const char *json, flecs::from_json_desc_t *desc=nullptr)
 Deserialize JSON into world.
 
const char * from_json_file (const char *json, flecs::from_json_desc_t *desc=nullptr)
 Deserialize JSON file into world.
 
template<typename... Args>
flecs::metric_builder metric (Args &&... args) const
 Create metric.
 
template<typename T >
flecs::timer timer () const
 Find or register a singleton timer.
 
flecs::app_builder app ()
 Return app builder.
 
template<typename... Args>
flecs::snapshot snapshot (Args &&... args) const
 Create a snapshot.
 
template<typename... Comps, typename... Args>
flecs::filter< Comps... > filter (Args &&... args) const
 Create a filter.
 
flecs::string to_expr (flecs::entity_t tid, const void *value)
 Convert value to string.
 
template<typename Module >
flecs::entity module (const char *name=nullptr) const
 Define a module.
 
flecs::observer observer (flecs::entity e) const
 Observer builder.
 
flecs::pipeline_builder pipeline () const
 Create a new pipeline.
 
template<typename... Comps, typename... Args>
flecs::query< Comps... > query (Args &&... args) const
 Create a query.
 
template<typename... Comps, typename... Args>
flecs::rule< Comps... > rule (Args &&... args) const
 Create a rule.
 
flecs::system system (flecs::entity e) const
 Upcast entity to a system.
 
template<typename... Args>
flecs::term term (Args &&... args) const
 Create a term.
 

Public Attributes

flecs::entity_t m_prev_scope
 
- Public Attributes inherited from flecs::world
world_t * m_world
 
bool m_owned
 

Additional Inherited Members

Detailed Description

Scoped world.

Utility class used by the world::scope method to create entities in a scope.

Definition at line 1109 of file world.hpp.

Constructor & Destructor Documentation

◆ scoped_world() [1/2]

flecs::scoped_world::scoped_world ( flecs::world_t * w,
flecs::entity_t s )
inline

Definition at line 1110 of file world.hpp.

◆ ~scoped_world()

flecs::scoped_world::~scoped_world ( )
inline

Definition at line 1119 of file world.hpp.

◆ scoped_world() [2/2]

flecs::scoped_world::scoped_world ( const scoped_world & obj)
inline

Definition at line 1123 of file world.hpp.

Member Data Documentation

◆ m_prev_scope

flecs::entity_t flecs::scoped_world::m_prev_scope

Definition at line 1129 of file world.hpp.


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