neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
neolib::ecs::i_ecs Class Referenceabstract

#include <i_ecs.hpp>

Inheritance diagram for neolib::ecs::i_ecs:
neolib::i_object neolib::i_lifetime

Classes

struct  component_not_found
 
struct  entity_archetype_not_found
 
struct  entity_ids_exhausted
 
struct  handle_ids_exhausted
 
struct  invalid_handle_id
 
struct  system_not_found
 
struct  uuid_exists
 

Public Types

typedef std::function< std::unique_ptr< i_component >()> component_factory
 
typedef std::function< std::unique_ptr< i_shared_component >()> shared_component_factory
 
typedef std::function< std::unique_ptr< i_system >()> system_factory
 
typedef voidhandle_t
 

Public Member Functions

 declare_event (systems_paused) declare_event(systems_resumed) declare_event(entity_created
 
entity_id declare_event (entity_destroyed, entity_id) declare_event(handle_updated
 
virtual neolib::i_lockablemutex () const =0
 
virtual neolib::thread_poolthread_pool () const =0
 
virtual ecs_flags flags () const =0
 
virtual entity_id create_entity (const entity_archetype_id &aArchetypeId)=0
 
virtual void async_create_entity (const std::function< void()> &aCreator)=0
 
virtual void commit_async_entity_creation ()=0
 
virtual void destroy_entity (entity_id aEntityId, bool aNotify=true)=0
 
virtual void async_destroy_entity (entity_id aEntityId, bool aNotify=true)=0
 
virtual void commit_async_entity_destruction ()=0
 
virtual bool run_threaded (const system_id &aSystemId) const =0
 
virtual bool all_systems_paused () const =0
 
virtual void pause_all_systems ()=0
 
virtual void resume_all_systems ()=0
 
virtual const archetype_registry_tarchetypes () const =0
 
virtual archetype_registry_tarchetypes ()=0
 
virtual const component_factories_tcomponent_factories () const =0
 
virtual component_factories_tcomponent_factories ()=0
 
virtual const components_tcomponents () const =0
 
virtual components_tcomponents ()=0
 
virtual const shared_component_factories_tshared_component_factories () const =0
 
virtual shared_component_factories_tshared_component_factories ()=0
 
virtual const shared_components_tshared_components () const =0
 
virtual shared_components_tshared_components ()=0
 
virtual const system_factories_tsystem_factories () const =0
 
virtual system_factories_tsystem_factories ()=0
 
virtual const systems_tsystems () const =0
 
virtual systems_tsystems ()=0
 
virtual const i_entity_archetypearchetype (entity_archetype_id aArchetypeId) const =0
 
virtual i_entity_archetypearchetype (entity_archetype_id aArchetypeId)=0
 
virtual bool component_instantiated (component_id aComponentId) const =0
 
virtual const i_componentcomponent (component_id aComponentId) const =0
 
virtual i_componentcomponent (component_id aComponentId)=0
 
virtual bool shared_component_instantiated (component_id aComponentId) const =0
 
virtual const i_shared_componentshared_component (component_id aComponentId) const =0
 
virtual i_shared_componentshared_component (component_id aComponentId)=0
 
virtual bool system_instantiated (system_id aSystemId) const =0
 
virtual const i_systemsystem (system_id aSystemId) const =0
 
virtual i_systemsystem (system_id aSystemId)=0
 
virtual entity_id next_entity_id ()=0
 
virtual void free_entity_id (entity_id aId)=0
 
virtual bool archetype_registered (const i_entity_archetype &aArchetype) const =0
 
virtual void register_archetype (const i_entity_archetype &aArchetype)=0
 
virtual void register_archetype (std::shared_ptr< const i_entity_archetype > aArchetype)=0
 
virtual bool component_registered (component_id aComponentId) const =0
 
virtual void register_component (component_id aComponentId, component_factory aFactory)=0
 
virtual bool shared_component_registered (component_id aComponentId) const =0
 
virtual void register_shared_component (component_id aComponentId, shared_component_factory aFactory)=0
 
virtual bool system_registered (system_id aSystemId) const =0
 
virtual void register_system (system_id aSystemId, system_factory aFactory)=0
 
virtual handle_t to_handle (handle_id aId) const =0
 
virtual handle_id add_handle (const std::type_info &aTypeInfo, handle_t aHandle)=0
 
virtual handle_t update_handle (handle_id aId, const std::type_info &aTypeInfo, handle_t aHandle)=0
 
virtual handle_t release_handle (handle_id aId)=0
 
template<typename... ComponentData>
entity_id create_entity (const entity_archetype_id &aArchetypeId, ComponentData &&... aComponentData)
 
template<typename Archetype , typename... ComponentData>
entity_id create_entity (const Archetype &aArchetype, ComponentData &&... aComponentData)
 
template<typename... ComponentData>
void async_create_entity (entity_archetype_id aArchetypeId, ComponentData... aComponentData)
 
template<typename Archetype , typename... ComponentData>
void async_create_entity (const Archetype &aArchetype, ComponentData... aComponentData)
 
template<typename ComponentData , typename... ComponentDataRest>
void populate (entity_id aEntity, ComponentData &&aComponentData, ComponentDataRest &&... aComponentDataRest)
 
template<typename ComponentData >
void populate (entity_id aEntity, ComponentData &&aComponentData)
 
template<typename ComponentData , typename... ComponentDataRest>
void populate_shared (const std::string &aName, ComponentData &&aComponentData, ComponentDataRest &&... aComponentDataRest)
 
template<typename ComponentData >
void populate_shared (const std::string &aName, ComponentData &&aComponentData)
 
template<typename ComponentData >
bool component_instantiated () const
 
template<typename ComponentData >
const neolib::ecs::component< ComponentData > & component () const
 
template<typename ComponentData >
neolib::ecs::component< ComponentData > & component ()
 
template<typename ComponentData >
bool shared_component_instantiated () const
 
template<typename ComponentData >
const neolib::ecs::shared_component< ComponentData > & shared_component () const
 
template<typename ComponentData >
neolib::ecs::shared_component< ComponentData > & shared_component ()
 
template<typename System >
bool system_instantiated () const
 
template<typename System >
const ecs_data_type_t< System > & system () const
 
template<typename System >
ecs_data_type_t< System > & system ()
 
template<typename ComponentData >
bool component_registered () const
 
template<typename ComponentData >
void register_component ()
 
template<typename ComponentData >
bool shared_component_registered () const
 
template<typename ComponentData >
void register_shared_component ()
 
template<typename System >
bool system_registered () const
 
template<typename System >
void register_system ()
 
template<typename Handle >
Handle to_handle (handle_id aId) const
 
template<typename Context , typename Handle >
handle_id add_handle (Handle aHandle)
 
template<typename Context , typename Handle >
Handle update_handle (handle_id aId, Handle aHandle)
 
template<typename Handle >
Handle release_handle (handle_id aId)
 
- Public Member Functions inherited from neolib::i_object
 declare_event (destroying)
 
 declare_event (destroyed)
 
virtual ~i_object ()=default
 
- Public Member Functions inherited from neolib::i_lifetime
virtual ~i_lifetime ()=default
 
virtual lifetime_state object_state () const =0
 
virtual std::shared_ptr< std::atomic< lifetime_state > > object_state_ptr () const =0
 
virtual bool is_creating () const =0
 
virtual bool is_alive () const =0
 
virtual bool is_destroying () const =0
 
virtual bool is_destroyed () const =0
 
virtual void set_alive ()=0
 
virtual void set_destroying ()=0
 
virtual void set_destroyed ()=0
 

Protected Types

typedef std::unordered_map< entity_archetype_id, std::shared_ptr< const i_entity_archetype >, quick_uuid_hasharchetype_registry_t
 
typedef std::unordered_map< component_id, component_factory, quick_uuid_hashcomponent_factories_t
 
typedef std::unordered_map< component_id, std::unique_ptr< i_component >, quick_uuid_hashcomponents_t
 
typedef std::unordered_map< component_id, shared_component_factory, quick_uuid_hashshared_component_factories_t
 
typedef std::unordered_map< component_id, std::unique_ptr< i_shared_component >, quick_uuid_hashshared_components_t
 
typedef std::unordered_map< system_id, system_factory, quick_uuid_hashsystem_factories_t
 
typedef std::unordered_map< system_id, std::unique_ptr< i_system >, quick_uuid_hashsystems_t
 

Detailed Description

Definition at line 84 of file i_ecs.hpp.

Member Typedef Documentation

◆ archetype_registry_t

Definition at line 105 of file i_ecs.hpp.

◆ component_factories_t

◆ component_factory

typedef std::function<std::unique_ptr<i_component>()> neolib::ecs::i_ecs::component_factory

Definition at line 101 of file i_ecs.hpp.

◆ components_t

typedef std::unordered_map<component_id, std::unique_ptr<i_component>, quick_uuid_hash> neolib::ecs::i_ecs::components_t
protected

Definition at line 107 of file i_ecs.hpp.

◆ handle_t

Definition at line 113 of file i_ecs.hpp.

◆ shared_component_factories_t

◆ shared_component_factory

Definition at line 102 of file i_ecs.hpp.

◆ shared_components_t

Definition at line 109 of file i_ecs.hpp.

◆ system_factories_t

Definition at line 110 of file i_ecs.hpp.

◆ system_factory

typedef std::function<std::unique_ptr<i_system>()> neolib::ecs::i_ecs::system_factory

Definition at line 103 of file i_ecs.hpp.

◆ systems_t

typedef std::unordered_map<system_id, std::unique_ptr<i_system>, quick_uuid_hash> neolib::ecs::i_ecs::systems_t
protected

Definition at line 111 of file i_ecs.hpp.

Member Function Documentation

◆ add_handle() [1/2]

virtual handle_id neolib::ecs::i_ecs::add_handle ( const std::type_info &  aTypeInfo,
handle_t  aHandle 
)
pure virtual

◆ add_handle() [2/2]

handle_id neolib::ecs::i_ecs::add_handle ( Handle  aHandle)
inline

Definition at line 299 of file i_ecs.hpp.

◆ all_systems_paused()

virtual bool neolib::ecs::i_ecs::all_systems_paused ( ) const
pure virtual

◆ archetype() [1/2]

virtual const i_entity_archetype & neolib::ecs::i_ecs::archetype ( entity_archetype_id  aArchetypeId) const
pure virtual

◆ archetype() [2/2]

virtual i_entity_archetype & neolib::ecs::i_ecs::archetype ( entity_archetype_id  aArchetypeId)
pure virtual

◆ archetype_registered()

virtual bool neolib::ecs::i_ecs::archetype_registered ( const i_entity_archetype aArchetype) const
pure virtual

◆ archetypes() [1/2]

virtual const archetype_registry_t & neolib::ecs::i_ecs::archetypes ( ) const
pure virtual

◆ archetypes() [2/2]

virtual archetype_registry_t & neolib::ecs::i_ecs::archetypes ( )
pure virtual

◆ async_create_entity() [1/3]

template<typename Archetype , typename... ComponentData>
void i_ecs::async_create_entity ( const Archetype aArchetype,
ComponentData...  aComponentData 
)
inline

Definition at line 514 of file i_ecs.hpp.

◆ async_create_entity() [2/3]

virtual void neolib::ecs::i_ecs::async_create_entity ( const std::function< void()> &  aCreator)
pure virtual

◆ async_create_entity() [3/3]

template<typename... ComponentData>
void i_ecs::async_create_entity ( entity_archetype_id  aArchetypeId,
ComponentData...  aComponentData 
)
inline

Definition at line 504 of file i_ecs.hpp.

◆ async_destroy_entity()

virtual void neolib::ecs::i_ecs::async_destroy_entity ( entity_id  aEntityId,
bool  aNotify = true 
)
pure virtual

◆ commit_async_entity_creation()

virtual void neolib::ecs::i_ecs::commit_async_entity_creation ( )
pure virtual

◆ commit_async_entity_destruction()

virtual void neolib::ecs::i_ecs::commit_async_entity_destruction ( )
pure virtual

◆ component() [1/4]

template<typename ComponentData >
neolib::ecs::component< ComponentData > & neolib::ecs::i_ecs::component ( )
inline

Definition at line 219 of file i_ecs.hpp.

◆ component() [2/4]

template<typename ComponentData >
const neolib::ecs::component< ComponentData > & neolib::ecs::i_ecs::component ( ) const
inline

Definition at line 214 of file i_ecs.hpp.

◆ component() [3/4]

virtual const i_component & neolib::ecs::i_ecs::component ( component_id  aComponentId) const
pure virtual

◆ component() [4/4]

virtual i_component & neolib::ecs::i_ecs::component ( component_id  aComponentId)
pure virtual

◆ component_factories() [1/2]

virtual const component_factories_t & neolib::ecs::i_ecs::component_factories ( ) const
pure virtual

◆ component_factories() [2/2]

virtual component_factories_t & neolib::ecs::i_ecs::component_factories ( )
pure virtual

◆ component_instantiated() [1/2]

template<typename ComponentData >
bool neolib::ecs::i_ecs::component_instantiated ( ) const
inline

Definition at line 209 of file i_ecs.hpp.

◆ component_instantiated() [2/2]

virtual bool neolib::ecs::i_ecs::component_instantiated ( component_id  aComponentId) const
pure virtual

◆ component_registered() [1/2]

template<typename ComponentData >
bool neolib::ecs::i_ecs::component_registered ( ) const
inline

Definition at line 261 of file i_ecs.hpp.

◆ component_registered() [2/2]

virtual bool neolib::ecs::i_ecs::component_registered ( component_id  aComponentId) const
pure virtual

◆ components() [1/2]

virtual const components_t & neolib::ecs::i_ecs::components ( ) const
pure virtual

◆ components() [2/2]

virtual components_t & neolib::ecs::i_ecs::components ( )
pure virtual

◆ create_entity() [1/3]

template<typename Archetype , typename... ComponentData>
entity_id i_ecs::create_entity ( const Archetype aArchetype,
ComponentData &&...  aComponentData 
)
inline

Definition at line 496 of file i_ecs.hpp.

◆ create_entity() [2/3]

virtual entity_id neolib::ecs::i_ecs::create_entity ( const entity_archetype_id aArchetypeId)
pure virtual

◆ create_entity() [3/3]

template<typename... ComponentData>
entity_id i_ecs::create_entity ( const entity_archetype_id aArchetypeId,
ComponentData &&...  aComponentData 
)
inline

Definition at line 486 of file i_ecs.hpp.

◆ declare_event() [1/2]

entity_id neolib::ecs::i_ecs::declare_event ( entity_destroyed  ,
entity_id   
)

◆ declare_event() [2/2]

neolib::ecs::i_ecs::declare_event ( systems_paused  )

◆ destroy_entity()

virtual void neolib::ecs::i_ecs::destroy_entity ( entity_id  aEntityId,
bool  aNotify = true 
)
pure virtual

◆ flags()

virtual ecs_flags neolib::ecs::i_ecs::flags ( ) const
pure virtual

◆ free_entity_id()

virtual void neolib::ecs::i_ecs::free_entity_id ( entity_id  aId)
pure virtual

◆ mutex()

virtual neolib::i_lockable & neolib::ecs::i_ecs::mutex ( ) const
pure virtual

◆ next_entity_id()

virtual entity_id neolib::ecs::i_ecs::next_entity_id ( )
pure virtual

◆ pause_all_systems()

virtual void neolib::ecs::i_ecs::pause_all_systems ( )
pure virtual

◆ populate() [1/2]

template<typename ComponentData >
void neolib::ecs::i_ecs::populate ( entity_id  aEntity,
ComponentData &&  aComponentData 
)
inline

Definition at line 193 of file i_ecs.hpp.

◆ populate() [2/2]

template<typename ComponentData , typename... ComponentDataRest>
void neolib::ecs::i_ecs::populate ( entity_id  aEntity,
ComponentData &&  aComponentData,
ComponentDataRest &&...  aComponentDataRest 
)
inline

Definition at line 187 of file i_ecs.hpp.

◆ populate_shared() [1/2]

template<typename ComponentData >
void neolib::ecs::i_ecs::populate_shared ( const std::string &  aName,
ComponentData &&  aComponentData 
)
inline

Definition at line 204 of file i_ecs.hpp.

◆ populate_shared() [2/2]

template<typename ComponentData , typename... ComponentDataRest>
void neolib::ecs::i_ecs::populate_shared ( const std::string &  aName,
ComponentData &&  aComponentData,
ComponentDataRest &&...  aComponentDataRest 
)
inline

Definition at line 198 of file i_ecs.hpp.

◆ register_archetype() [1/2]

virtual void neolib::ecs::i_ecs::register_archetype ( const i_entity_archetype aArchetype)
pure virtual

◆ register_archetype() [2/2]

virtual void neolib::ecs::i_ecs::register_archetype ( std::shared_ptr< const i_entity_archetype aArchetype)
pure virtual

◆ register_component() [1/2]

template<typename ComponentData >
void neolib::ecs::i_ecs::register_component ( )
inline

Definition at line 266 of file i_ecs.hpp.

◆ register_component() [2/2]

virtual void neolib::ecs::i_ecs::register_component ( component_id  aComponentId,
component_factory  aFactory 
)
pure virtual

◆ register_shared_component() [1/2]

template<typename ComponentData >
void neolib::ecs::i_ecs::register_shared_component ( )
inline

Definition at line 276 of file i_ecs.hpp.

◆ register_shared_component() [2/2]

virtual void neolib::ecs::i_ecs::register_shared_component ( component_id  aComponentId,
shared_component_factory  aFactory 
)
pure virtual

◆ register_system() [1/2]

template<typename System >
void neolib::ecs::i_ecs::register_system ( )
inline

Definition at line 286 of file i_ecs.hpp.

◆ register_system() [2/2]

virtual void neolib::ecs::i_ecs::register_system ( system_id  aSystemId,
system_factory  aFactory 
)
pure virtual

◆ release_handle() [1/2]

template<typename Handle >
Handle neolib::ecs::i_ecs::release_handle ( handle_id  aId)
inline

Definition at line 312 of file i_ecs.hpp.

◆ release_handle() [2/2]

virtual handle_t neolib::ecs::i_ecs::release_handle ( handle_id  aId)
pure virtual

◆ resume_all_systems()

virtual void neolib::ecs::i_ecs::resume_all_systems ( )
pure virtual

◆ run_threaded()

virtual bool neolib::ecs::i_ecs::run_threaded ( const system_id aSystemId) const
pure virtual

◆ shared_component() [1/4]

template<typename ComponentData >
neolib::ecs::shared_component< ComponentData > & neolib::ecs::i_ecs::shared_component ( )
inline

Definition at line 236 of file i_ecs.hpp.

◆ shared_component() [2/4]

template<typename ComponentData >
const neolib::ecs::shared_component< ComponentData > & neolib::ecs::i_ecs::shared_component ( ) const
inline

Definition at line 231 of file i_ecs.hpp.

◆ shared_component() [3/4]

virtual const i_shared_component & neolib::ecs::i_ecs::shared_component ( component_id  aComponentId) const
pure virtual

◆ shared_component() [4/4]

virtual i_shared_component & neolib::ecs::i_ecs::shared_component ( component_id  aComponentId)
pure virtual

◆ shared_component_factories() [1/2]

virtual const shared_component_factories_t & neolib::ecs::i_ecs::shared_component_factories ( ) const
pure virtual

◆ shared_component_factories() [2/2]

virtual shared_component_factories_t & neolib::ecs::i_ecs::shared_component_factories ( )
pure virtual

◆ shared_component_instantiated() [1/2]

template<typename ComponentData >
bool neolib::ecs::i_ecs::shared_component_instantiated ( ) const
inline

Definition at line 226 of file i_ecs.hpp.

◆ shared_component_instantiated() [2/2]

virtual bool neolib::ecs::i_ecs::shared_component_instantiated ( component_id  aComponentId) const
pure virtual

◆ shared_component_registered() [1/2]

template<typename ComponentData >
bool neolib::ecs::i_ecs::shared_component_registered ( ) const
inline

Definition at line 271 of file i_ecs.hpp.

◆ shared_component_registered() [2/2]

virtual bool neolib::ecs::i_ecs::shared_component_registered ( component_id  aComponentId) const
pure virtual

◆ shared_components() [1/2]

virtual const shared_components_t & neolib::ecs::i_ecs::shared_components ( ) const
pure virtual

◆ shared_components() [2/2]

virtual shared_components_t & neolib::ecs::i_ecs::shared_components ( )
pure virtual

◆ system() [1/4]

template<typename System >
ecs_data_type_t< System > & neolib::ecs::i_ecs::system ( )
inline

Definition at line 253 of file i_ecs.hpp.

◆ system() [2/4]

template<typename System >
const ecs_data_type_t< System > & neolib::ecs::i_ecs::system ( ) const
inline

Definition at line 248 of file i_ecs.hpp.

◆ system() [3/4]

virtual const i_system & neolib::ecs::i_ecs::system ( system_id  aSystemId) const
pure virtual

◆ system() [4/4]

virtual i_system & neolib::ecs::i_ecs::system ( system_id  aSystemId)
pure virtual

◆ system_factories() [1/2]

virtual const system_factories_t & neolib::ecs::i_ecs::system_factories ( ) const
pure virtual

◆ system_factories() [2/2]

virtual system_factories_t & neolib::ecs::i_ecs::system_factories ( )
pure virtual

◆ system_instantiated() [1/2]

template<typename System >
bool neolib::ecs::i_ecs::system_instantiated ( ) const
inline

Definition at line 243 of file i_ecs.hpp.

◆ system_instantiated() [2/2]

virtual bool neolib::ecs::i_ecs::system_instantiated ( system_id  aSystemId) const
pure virtual

◆ system_registered() [1/2]

template<typename System >
bool neolib::ecs::i_ecs::system_registered ( ) const
inline

Definition at line 281 of file i_ecs.hpp.

◆ system_registered() [2/2]

virtual bool neolib::ecs::i_ecs::system_registered ( system_id  aSystemId) const
pure virtual

◆ systems() [1/2]

virtual const systems_t & neolib::ecs::i_ecs::systems ( ) const
pure virtual

◆ systems() [2/2]

virtual systems_t & neolib::ecs::i_ecs::systems ( )
pure virtual

◆ thread_pool()

virtual neolib::thread_pool & neolib::ecs::i_ecs::thread_pool ( ) const
pure virtual

◆ to_handle() [1/2]

template<typename Handle >
Handle neolib::ecs::i_ecs::to_handle ( handle_id  aId) const
inline

Definition at line 294 of file i_ecs.hpp.

◆ to_handle() [2/2]

virtual handle_t neolib::ecs::i_ecs::to_handle ( handle_id  aId) const
pure virtual

◆ update_handle() [1/2]

virtual handle_t neolib::ecs::i_ecs::update_handle ( handle_id  aId,
const std::type_info &  aTypeInfo,
handle_t  aHandle 
)
pure virtual

◆ update_handle() [2/2]

Handle neolib::ecs::i_ecs::update_handle ( handle_id  aId,
Handle  aHandle 
)
inline

Definition at line 304 of file i_ecs.hpp.


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