neoGFX
Cross-platform C++ app/game engine
neogfx::game::i_ecs Class Referenceabstract

#include <i_ecs.hpp>

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 id_t handle_id
 
typedef void * handle_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 ecs_flags flags () const =0
 
virtual entity_id create_entity (const entity_archetype_id &aArchetypeId)=0
 
virtual void destroy_entity (entity_id aEntityId)=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 , 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 static_component< ComponentData > & component () const
 
template<typename ComponentData >
static_component< ComponentData > & component ()
 
template<typename ComponentData >
bool shared_component_instantiated () const
 
template<typename ComponentData >
const static_shared_component< ComponentData > & shared_component () const
 
template<typename ComponentData >
static_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)
 

Protected Types

typedef std::map< entity_archetype_id, std::shared_ptr< const i_entity_archetype > > archetype_registry_t
 
typedef std::map< component_id, component_factorycomponent_factories_t
 
typedef std::map< component_id, std::unique_ptr< i_component > > components_t
 
typedef std::map< component_id, shared_component_factoryshared_component_factories_t
 
typedef std::map< component_id, std::unique_ptr< i_shared_component > > shared_components_t
 
typedef std::map< system_id, system_factorysystem_factories_t
 
typedef std::map< system_id, std::unique_ptr< i_system > > systems_t
 

Detailed Description

Definition at line 59 of file i_ecs.hpp.

Member Typedef Documentation

◆ archetype_registry_t

typedef std::map<entity_archetype_id, std::shared_ptr<const i_entity_archetype> > neogfx::game::i_ecs::archetype_registry_t
protected

Definition at line 80 of file i_ecs.hpp.

◆ component_factories_t

Definition at line 81 of file i_ecs.hpp.

◆ component_factory

typedef std::function<std::unique_ptr<i_component>)> neogfx::game::i_ecs::component_factory

Definition at line 76 of file i_ecs.hpp.

◆ components_t

typedef std::map<component_id, std::unique_ptr<i_component> > neogfx::game::i_ecs::components_t
protected

Definition at line 82 of file i_ecs.hpp.

◆ handle_id

Definition at line 88 of file i_ecs.hpp.

◆ handle_t

Definition at line 89 of file i_ecs.hpp.

◆ shared_component_factories_t

◆ shared_component_factory

typedef std::function<std::unique_ptr<i_shared_component>)> neogfx::game::i_ecs::shared_component_factory

Definition at line 77 of file i_ecs.hpp.

◆ shared_components_t

typedef std::map<component_id, std::unique_ptr<i_shared_component> > neogfx::game::i_ecs::shared_components_t
protected

Definition at line 84 of file i_ecs.hpp.

◆ system_factories_t

Definition at line 85 of file i_ecs.hpp.

◆ system_factory

typedef std::function<std::unique_ptr<i_system>)> neogfx::game::i_ecs::system_factory

Definition at line 78 of file i_ecs.hpp.

◆ systems_t

typedef std::map<system_id, std::unique_ptr<i_system> > neogfx::game::i_ecs::systems_t
protected

Definition at line 86 of file i_ecs.hpp.

Member Function Documentation

◆ add_handle() [1/2]

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

◆ add_handle() [2/2]

template<typename Context , typename Handle >
handle_id neogfx::game::i_ecs::add_handle ( Handle  aHandle)
inline

Definition at line 274 of file i_ecs.hpp.

◆ all_systems_paused()

virtual bool neogfx::game::i_ecs::all_systems_paused ( ) const
pure virtual

◆ archetype() [1/2]

virtual const i_entity_archetype& neogfx::game::i_ecs::archetype ( entity_archetype_id  aArchetypeId) const
pure virtual

◆ archetype() [2/2]

virtual i_entity_archetype& neogfx::game::i_ecs::archetype ( entity_archetype_id  aArchetypeId)
pure virtual

◆ archetype_registered()

virtual bool neogfx::game::i_ecs::archetype_registered ( const i_entity_archetype aArchetype) const
pure virtual

◆ archetypes() [1/2]

virtual const archetype_registry_t& neogfx::game::i_ecs::archetypes ( ) const
pure virtual

◆ archetypes() [2/2]

virtual archetype_registry_t& neogfx::game::i_ecs::archetypes ( )
pure virtual

◆ component() [1/4]

virtual const i_component& neogfx::game::i_ecs::component ( component_id  aComponentId) const
pure virtual

◆ component() [2/4]

virtual i_component& neogfx::game::i_ecs::component ( component_id  aComponentId)
pure virtual

◆ component() [3/4]

template<typename ComponentData >
const static_component<ComponentData>& neogfx::game::i_ecs::component ( ) const
inline

Definition at line 189 of file i_ecs.hpp.

◆ component() [4/4]

template<typename ComponentData >
static_component<ComponentData>& neogfx::game::i_ecs::component ( )
inline

Definition at line 194 of file i_ecs.hpp.

◆ component_factories() [1/2]

virtual const component_factories_t& neogfx::game::i_ecs::component_factories ( ) const
pure virtual

◆ component_factories() [2/2]

virtual component_factories_t& neogfx::game::i_ecs::component_factories ( )
pure virtual

◆ component_instantiated() [1/2]

virtual bool neogfx::game::i_ecs::component_instantiated ( component_id  aComponentId) const
pure virtual

◆ component_instantiated() [2/2]

template<typename ComponentData >
bool neogfx::game::i_ecs::component_instantiated ( ) const
inline

Definition at line 184 of file i_ecs.hpp.

◆ component_registered() [1/2]

virtual bool neogfx::game::i_ecs::component_registered ( component_id  aComponentId) const
pure virtual

◆ component_registered() [2/2]

template<typename ComponentData >
bool neogfx::game::i_ecs::component_registered ( ) const
inline

Definition at line 236 of file i_ecs.hpp.

◆ components() [1/2]

virtual const components_t& neogfx::game::i_ecs::components ( ) const
pure virtual

◆ components() [2/2]

virtual components_t& neogfx::game::i_ecs::components ( )
pure virtual

◆ create_entity() [1/3]

virtual entity_id neogfx::game::i_ecs::create_entity ( const entity_archetype_id aArchetypeId)
pure virtual

◆ create_entity() [2/3]

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

Definition at line 146 of file i_ecs.hpp.

◆ create_entity() [3/3]

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

Definition at line 154 of file i_ecs.hpp.

◆ declare_event() [1/2]

neogfx::game::i_ecs::declare_event ( systems_paused  )

◆ declare_event() [2/2]

entity_id neogfx::game::i_ecs::declare_event ( entity_destroyed  ,
entity_id   
)

◆ destroy_entity()

virtual void neogfx::game::i_ecs::destroy_entity ( entity_id  aEntityId)
pure virtual

◆ flags()

virtual ecs_flags neogfx::game::i_ecs::flags ( ) const
pure virtual

◆ free_entity_id()

virtual void neogfx::game::i_ecs::free_entity_id ( entity_id  aId)
pure virtual

◆ next_entity_id()

virtual entity_id neogfx::game::i_ecs::next_entity_id ( )
pure virtual

◆ pause_all_systems()

virtual void neogfx::game::i_ecs::pause_all_systems ( )
pure virtual

◆ populate() [1/2]

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

Definition at line 162 of file i_ecs.hpp.

◆ populate() [2/2]

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

Definition at line 168 of file i_ecs.hpp.

◆ populate_shared() [1/2]

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

Definition at line 173 of file i_ecs.hpp.

◆ populate_shared() [2/2]

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

Definition at line 179 of file i_ecs.hpp.

◆ register_archetype() [1/2]

virtual void neogfx::game::i_ecs::register_archetype ( const i_entity_archetype aArchetype)
pure virtual

◆ register_archetype() [2/2]

virtual void neogfx::game::i_ecs::register_archetype ( std::shared_ptr< const i_entity_archetype aArchetype)
pure virtual

◆ register_component() [1/2]

virtual void neogfx::game::i_ecs::register_component ( component_id  aComponentId,
component_factory  aFactory 
)
pure virtual

◆ register_component() [2/2]

template<typename ComponentData >
void neogfx::game::i_ecs::register_component ( )
inline

Definition at line 241 of file i_ecs.hpp.

◆ register_shared_component() [1/2]

virtual void neogfx::game::i_ecs::register_shared_component ( component_id  aComponentId,
shared_component_factory  aFactory 
)
pure virtual

◆ register_shared_component() [2/2]

template<typename ComponentData >
void neogfx::game::i_ecs::register_shared_component ( )
inline

Definition at line 251 of file i_ecs.hpp.

◆ register_system() [1/2]

virtual void neogfx::game::i_ecs::register_system ( system_id  aSystemId,
system_factory  aFactory 
)
pure virtual

◆ register_system() [2/2]

template<typename System >
void neogfx::game::i_ecs::register_system ( )
inline

Definition at line 261 of file i_ecs.hpp.

◆ release_handle() [1/2]

virtual handle_t neogfx::game::i_ecs::release_handle ( handle_id  aId)
pure virtual

◆ release_handle() [2/2]

template<typename Handle >
Handle neogfx::game::i_ecs::release_handle ( handle_id  aId)
inline

Definition at line 287 of file i_ecs.hpp.

◆ resume_all_systems()

virtual void neogfx::game::i_ecs::resume_all_systems ( )
pure virtual

◆ shared_component() [1/4]

virtual const i_shared_component& neogfx::game::i_ecs::shared_component ( component_id  aComponentId) const
pure virtual

◆ shared_component() [2/4]

virtual i_shared_component& neogfx::game::i_ecs::shared_component ( component_id  aComponentId)
pure virtual

◆ shared_component() [3/4]

template<typename ComponentData >
const static_shared_component<ComponentData>& neogfx::game::i_ecs::shared_component ( ) const
inline

Definition at line 206 of file i_ecs.hpp.

◆ shared_component() [4/4]

template<typename ComponentData >
static_shared_component<ComponentData>& neogfx::game::i_ecs::shared_component ( )
inline

Definition at line 211 of file i_ecs.hpp.

◆ shared_component_factories() [1/2]

virtual const shared_component_factories_t& neogfx::game::i_ecs::shared_component_factories ( ) const
pure virtual

◆ shared_component_factories() [2/2]

virtual shared_component_factories_t& neogfx::game::i_ecs::shared_component_factories ( )
pure virtual

◆ shared_component_instantiated() [1/2]

virtual bool neogfx::game::i_ecs::shared_component_instantiated ( component_id  aComponentId) const
pure virtual

◆ shared_component_instantiated() [2/2]

template<typename ComponentData >
bool neogfx::game::i_ecs::shared_component_instantiated ( ) const
inline

Definition at line 201 of file i_ecs.hpp.

◆ shared_component_registered() [1/2]

virtual bool neogfx::game::i_ecs::shared_component_registered ( component_id  aComponentId) const
pure virtual

◆ shared_component_registered() [2/2]

template<typename ComponentData >
bool neogfx::game::i_ecs::shared_component_registered ( ) const
inline

Definition at line 246 of file i_ecs.hpp.

◆ shared_components() [1/2]

virtual const shared_components_t& neogfx::game::i_ecs::shared_components ( ) const
pure virtual

◆ shared_components() [2/2]

virtual shared_components_t& neogfx::game::i_ecs::shared_components ( )
pure virtual

◆ system() [1/4]

virtual const i_system& neogfx::game::i_ecs::system ( system_id  aSystemId) const
pure virtual

◆ system() [2/4]

virtual i_system& neogfx::game::i_ecs::system ( system_id  aSystemId)
pure virtual

◆ system() [3/4]

template<typename System >
const ecs_data_type_t<System>& neogfx::game::i_ecs::system ( ) const
inline

Definition at line 223 of file i_ecs.hpp.

◆ system() [4/4]

template<typename System >
ecs_data_type_t<System>& neogfx::game::i_ecs::system ( )
inline

Definition at line 228 of file i_ecs.hpp.

◆ system_factories() [1/2]

virtual const system_factories_t& neogfx::game::i_ecs::system_factories ( ) const
pure virtual

◆ system_factories() [2/2]

virtual system_factories_t& neogfx::game::i_ecs::system_factories ( )
pure virtual

◆ system_instantiated() [1/2]

virtual bool neogfx::game::i_ecs::system_instantiated ( system_id  aSystemId) const
pure virtual

◆ system_instantiated() [2/2]

template<typename System >
bool neogfx::game::i_ecs::system_instantiated ( ) const
inline

Definition at line 218 of file i_ecs.hpp.

◆ system_registered() [1/2]

virtual bool neogfx::game::i_ecs::system_registered ( system_id  aSystemId) const
pure virtual

◆ system_registered() [2/2]

template<typename System >
bool neogfx::game::i_ecs::system_registered ( ) const
inline

Definition at line 256 of file i_ecs.hpp.

◆ systems() [1/2]

virtual const systems_t& neogfx::game::i_ecs::systems ( ) const
pure virtual

◆ systems() [2/2]

virtual systems_t& neogfx::game::i_ecs::systems ( )
pure virtual

◆ to_handle() [1/2]

virtual handle_t neogfx::game::i_ecs::to_handle ( handle_id  aId) const
pure virtual

◆ to_handle() [2/2]

template<typename Handle >
Handle neogfx::game::i_ecs::to_handle ( handle_id  aId) const
inline

Definition at line 269 of file i_ecs.hpp.

◆ update_handle() [1/2]

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

◆ update_handle() [2/2]

template<typename Context , typename Handle >
Handle neogfx::game::i_ecs::update_handle ( handle_id  aId,
Handle  aHandle 
)
inline

Definition at line 279 of file i_ecs.hpp.


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