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

#include <ecs.hpp>

Inheritance diagram for neolib::ecs::ecs:
neolib::object< i_ecs > neolib::lifetime< Base > neolib::i_lifetime neogfx::game::ecs

Public Member Functions

 define_declared_event (SystemsPaused, systems_paused) define_declared_event(SystemsResumed
 
systems_resumed define_declared_event (EntityCreated, entity_created, entity_id) define_declared_event(EntityDestroyed
 
 ecs (ecs_flags aCreationFlags=ecs_flags::Default)
 
 ~ecs ()
 
neolib::recursive_spinlockmutex () const override
 
neolib::thread_poolthread_pool () const override
 
ecs_flags flags () const override
 
entity_id create_entity (const entity_archetype_id &aArchetypeId) override
 
void async_create_entity (const std::function< void()> &aCreator) override
 
void commit_async_entity_creation () override
 
void destroy_entity (entity_id aEntityId, bool aNotify=true) override
 
void async_destroy_entity (entity_id aEntityId, bool aNotify=true) override
 
void commit_async_entity_destruction () override
 
bool run_threaded (const system_id &aSystemId) const override
 
bool all_systems_paused () const override
 
void pause_all_systems () override
 
void resume_all_systems () override
 
const archetype_registry_t & archetypes () const override
 
archetype_registry_t & archetypes () override
 
const component_factories_t & component_factories () const override
 
component_factories_t & component_factories () override
 
const components_t & components () const override
 
components_t & components () override
 
const shared_component_factories_t & shared_component_factories () const override
 
shared_component_factories_t & shared_component_factories () override
 
const shared_components_t & shared_components () const override
 
shared_components_t & shared_components () override
 
const system_factories_t & system_factories () const override
 
system_factories_t & system_factories () override
 
const systems_t & systems () const override
 
systems_t & systems () override
 
const i_entity_archetypearchetype (entity_archetype_id aArchetypeId) const override
 
i_entity_archetypearchetype (entity_archetype_id aArchetypeId) override
 
bool component_instantiated (component_id aComponentId) const override
 
const i_componentcomponent (component_id aComponentId) const override
 
i_componentcomponent (component_id aComponentId) override
 
bool shared_component_instantiated (component_id aComponentId) const override
 
const i_shared_componentshared_component (component_id aComponentId) const override
 
i_shared_componentshared_component (component_id aComponentId) override
 
bool system_instantiated (system_id aSystemId) const override
 
const i_systemsystem (system_id aSystemId) const override
 
i_systemsystem (system_id aSystemId) override
 
entity_id next_entity_id () override
 
void free_entity_id (entity_id aId) override
 
bool archetype_registered (const i_entity_archetype &aArchetype) const override
 
void register_archetype (const i_entity_archetype &aArchetype) override
 
void register_archetype (std::shared_ptr< const i_entity_archetype > aArchetype) override
 
bool component_registered (component_id aComponentId) const override
 
void register_component (component_id aComponentId, component_factory aFactory) override
 
bool shared_component_registered (component_id aComponentId) const override
 
void register_shared_component (component_id aComponentId, shared_component_factory aFactory) override
 
bool system_registered (system_id aSystemId) const override
 
void register_system (system_id aSystemId, system_factory aFactory) override
 
handle_t to_handle (handle_id aId) const override
 
handle_id add_handle (const std::type_info &aTypeInfo, handle_t aHandle) override
 
handle_t update_handle (handle_id aId, const std::type_info &aTypeInfo, handle_t aHandle) override
 
handle_t release_handle (handle_id aId) override
 
virtual entity_id create_entity (const entity_archetype_id &aArchetypeId)=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)
 
virtual bool component_instantiated (component_id aComponentId) const=0
 
template<typename ComponentData >
bool component_instantiated () const
 
virtual const i_componentcomponent (component_id aComponentId) const=0
 
virtual i_componentcomponent (component_id aComponentId)=0
 
template<typename ComponentData >
const neolib::ecs::component< ComponentData > & component () const
 
template<typename ComponentData >
neolib::ecs::component< ComponentData > & component ()
 
virtual bool shared_component_instantiated (component_id aComponentId) const=0
 
template<typename ComponentData >
bool shared_component_instantiated () const
 
virtual const i_shared_componentshared_component (component_id aComponentId) const=0
 
virtual i_shared_componentshared_component (component_id aComponentId)=0
 
template<typename ComponentData >
const neolib::ecs::shared_component< ComponentData > & shared_component () const
 
template<typename ComponentData >
neolib::ecs::shared_component< ComponentData > & shared_component ()
 
virtual bool system_instantiated (system_id aSystemId) const=0
 
template<typename System >
bool system_instantiated () const
 
virtual const i_systemsystem (system_id aSystemId) const=0
 
virtual i_systemsystem (system_id aSystemId)=0
 
template<typename System >
const ecs_data_type_t< System > & system () const
 
template<typename System >
ecs_data_type_t< System > & system ()
 
virtual bool component_registered (component_id aComponentId) const=0
 
template<typename ComponentData >
bool component_registered () const
 
virtual void register_component (component_id aComponentId, component_factory aFactory)=0
 
template<typename ComponentData >
void register_component ()
 
virtual bool shared_component_registered (component_id aComponentId) const=0
 
template<typename ComponentData >
bool shared_component_registered () const
 
virtual void register_shared_component (component_id aComponentId, shared_component_factory aFactory)=0
 
template<typename ComponentData >
void register_shared_component ()
 
virtual bool system_registered (system_id aSystemId) const=0
 
template<typename System >
bool system_registered () const
 
virtual void register_system (system_id aSystemId, system_factory aFactory)=0
 
template<typename System >
void register_system ()
 
- Public Member Functions inherited from neolib::object< i_ecs >
 define_declared_event (Destroying, destroying)
 
 define_declared_event (Destroyed, destroyed)
 
 object (lifetime_state aState=lifetime_state::Creating)
 
 ~object ()
 
void set_destroying () override
 
void set_destroyed () override
 
bool is_alive () const final
 
bool is_destroyed () const final
 
- Public Member Functions inherited from neolib::lifetime< Base >
 lifetime (lifetime_state aState=lifetime_state::Alive)
 
virtual ~lifetime ()
 
lifetime_state object_state () const final
 
std::shared_ptr< std::atomic< lifetime_state > > object_state_ptr () const final
 
bool is_creating () const final
 
bool is_destroying () const final
 
void set_alive () override
 
- Public Member Functions inherited from neolib::i_lifetime
virtual ~i_lifetime ()=default
 

Public Attributes

systems_resumed entity_destroyed
 

Additional Inherited Members

- Public Types inherited from neolib::lifetime< Base >
typedef neolib::destroyed_flag destroyed_flag
 

Detailed Description

Definition at line 50 of file ecs.hpp.

Constructor & Destructor Documentation

◆ ecs()

neolib::ecs::ecs::ecs ( ecs_flags  aCreationFlags = ecs_flags::Default)

◆ ~ecs()

neolib::ecs::ecs::~ecs ( )

Member Function Documentation

◆ add_handle()

handle_id neolib::ecs::ecs::add_handle ( const std::type_info &  aTypeInfo,
handle_t  aHandle 
)
override

◆ all_systems_paused()

bool neolib::ecs::ecs::all_systems_paused ( ) const
override

◆ archetype() [1/2]

const i_entity_archetype & neolib::ecs::ecs::archetype ( entity_archetype_id  aArchetypeId) const
override

◆ archetype() [2/2]

i_entity_archetype & neolib::ecs::ecs::archetype ( entity_archetype_id  aArchetypeId)
override

◆ archetype_registered()

bool neolib::ecs::ecs::archetype_registered ( const i_entity_archetype aArchetype) const
override

◆ archetypes() [1/2]

const archetype_registry_t & neolib::ecs::ecs::archetypes ( ) const
override

◆ archetypes() [2/2]

archetype_registry_t & neolib::ecs::ecs::archetypes ( )
override

◆ async_create_entity()

void neolib::ecs::ecs::async_create_entity ( const std::function< void()> &  aCreator)
override

◆ async_destroy_entity()

void neolib::ecs::ecs::async_destroy_entity ( entity_id  aEntityId,
bool  aNotify = true 
)
override

◆ commit_async_entity_creation()

void neolib::ecs::ecs::commit_async_entity_creation ( )
override

◆ commit_async_entity_destruction()

void neolib::ecs::ecs::commit_async_entity_destruction ( )
override

◆ component() [1/6]

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

Definition at line 219 of file i_ecs.hpp.

◆ component() [2/6]

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/6]

const i_component & neolib::ecs::ecs::component ( component_id  aComponentId) const
override

◆ component() [4/6]

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

◆ component() [5/6]

i_component & neolib::ecs::ecs::component ( component_id  aComponentId)
override

◆ component() [6/6]

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

◆ component_factories() [1/2]

const component_factories_t & neolib::ecs::ecs::component_factories ( ) const
override

◆ component_factories() [2/2]

component_factories_t & neolib::ecs::ecs::component_factories ( )
override

◆ component_instantiated() [1/3]

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

Definition at line 209 of file i_ecs.hpp.

◆ component_instantiated() [2/3]

bool neolib::ecs::ecs::component_instantiated ( component_id  aComponentId) const
override

◆ component_instantiated() [3/3]

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

◆ component_registered() [1/3]

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

Definition at line 261 of file i_ecs.hpp.

◆ component_registered() [2/3]

bool neolib::ecs::ecs::component_registered ( component_id  aComponentId) const
override

◆ component_registered() [3/3]

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

◆ components() [1/2]

const components_t & neolib::ecs::ecs::components ( ) const
override

◆ components() [2/2]

components_t & neolib::ecs::ecs::components ( )
override

◆ create_entity() [1/4]

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

Definition at line 180 of file i_ecs.hpp.

◆ create_entity() [2/4]

entity_id neolib::ecs::ecs::create_entity ( const entity_archetype_id aArchetypeId)
override

◆ create_entity() [3/4]

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

◆ create_entity() [4/4]

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

Definition at line 178 of file i_ecs.hpp.

◆ define_declared_event() [1/2]

systems_resumed neolib::ecs::ecs::define_declared_event ( EntityCreated  ,
entity_created  ,
entity_id   
)

◆ define_declared_event() [2/2]

neolib::ecs::ecs::define_declared_event ( SystemsPaused  ,
systems_paused   
)

◆ destroy_entity()

void neolib::ecs::ecs::destroy_entity ( entity_id  aEntityId,
bool  aNotify = true 
)
override

◆ flags()

ecs_flags neolib::ecs::ecs::flags ( ) const
override

◆ free_entity_id()

void neolib::ecs::ecs::free_entity_id ( entity_id  aId)
override

◆ mutex()

neolib::recursive_spinlock & neolib::ecs::ecs::mutex ( ) const
override

◆ next_entity_id()

entity_id neolib::ecs::ecs::next_entity_id ( )
override

◆ pause_all_systems()

void neolib::ecs::ecs::pause_all_systems ( )
override

◆ 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]

void neolib::ecs::ecs::register_archetype ( const i_entity_archetype aArchetype)
override

◆ register_archetype() [2/2]

void neolib::ecs::ecs::register_archetype ( std::shared_ptr< const i_entity_archetype aArchetype)
override

◆ register_component() [1/3]

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

Definition at line 266 of file i_ecs.hpp.

◆ register_component() [2/3]

void neolib::ecs::ecs::register_component ( component_id  aComponentId,
component_factory  aFactory 
)
override

◆ register_component() [3/3]

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

◆ register_shared_component() [1/3]

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/3]

void neolib::ecs::ecs::register_shared_component ( component_id  aComponentId,
shared_component_factory  aFactory 
)
override

◆ register_shared_component() [3/3]

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

◆ register_system() [1/3]

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

Definition at line 286 of file i_ecs.hpp.

◆ register_system() [2/3]

void neolib::ecs::ecs::register_system ( system_id  aSystemId,
system_factory  aFactory 
)
override

◆ register_system() [3/3]

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

◆ release_handle()

handle_t neolib::ecs::ecs::release_handle ( handle_id  aId)
override

◆ resume_all_systems()

void neolib::ecs::ecs::resume_all_systems ( )
override

◆ run_threaded()

bool neolib::ecs::ecs::run_threaded ( const system_id aSystemId) const
override

◆ shared_component() [1/6]

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/6]

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/6]

const i_shared_component & neolib::ecs::ecs::shared_component ( component_id  aComponentId) const
override

◆ shared_component() [4/6]

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

◆ shared_component() [5/6]

i_shared_component & neolib::ecs::ecs::shared_component ( component_id  aComponentId)
override

◆ shared_component() [6/6]

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

◆ shared_component_factories() [1/2]

const shared_component_factories_t & neolib::ecs::ecs::shared_component_factories ( ) const
override

◆ shared_component_factories() [2/2]

shared_component_factories_t & neolib::ecs::ecs::shared_component_factories ( )
override

◆ shared_component_instantiated() [1/3]

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/3]

bool neolib::ecs::ecs::shared_component_instantiated ( component_id  aComponentId) const
override

◆ shared_component_instantiated() [3/3]

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

◆ shared_component_registered() [1/3]

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/3]

bool neolib::ecs::ecs::shared_component_registered ( component_id  aComponentId) const
override

◆ shared_component_registered() [3/3]

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

◆ shared_components() [1/2]

const shared_components_t & neolib::ecs::ecs::shared_components ( ) const
override

◆ shared_components() [2/2]

shared_components_t & neolib::ecs::ecs::shared_components ( )
override

◆ system() [1/6]

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/6]

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/6]

const i_system & neolib::ecs::ecs::system ( system_id  aSystemId) const
override

◆ system() [4/6]

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

◆ system() [5/6]

i_system & neolib::ecs::ecs::system ( system_id  aSystemId)
override

◆ system() [6/6]

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

◆ system_factories() [1/2]

const system_factories_t & neolib::ecs::ecs::system_factories ( ) const
override

◆ system_factories() [2/2]

system_factories_t & neolib::ecs::ecs::system_factories ( )
override

◆ system_instantiated() [1/3]

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

Definition at line 243 of file i_ecs.hpp.

◆ system_instantiated() [2/3]

bool neolib::ecs::ecs::system_instantiated ( system_id  aSystemId) const
override

◆ system_instantiated() [3/3]

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

◆ system_registered() [1/3]

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

Definition at line 281 of file i_ecs.hpp.

◆ system_registered() [2/3]

bool neolib::ecs::ecs::system_registered ( system_id  aSystemId) const
override

◆ system_registered() [3/3]

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

◆ systems() [1/2]

const systems_t & neolib::ecs::ecs::systems ( ) const
override

◆ systems() [2/2]

systems_t & neolib::ecs::ecs::systems ( )
override

◆ thread_pool()

neolib::thread_pool & neolib::ecs::ecs::thread_pool ( ) const
override

◆ to_handle()

handle_t neolib::ecs::ecs::to_handle ( handle_id  aId) const
override

◆ update_handle()

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

Member Data Documentation

◆ entity_destroyed

systems_resumed neolib::ecs::ecs::entity_destroyed

Definition at line 56 of file ecs.hpp.


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