#include <Instance.hpp>
Public Member Functions | |
Instance (const SystemContainer *sc) | |
virtual | ~Instance () |
Instance * | instance () |
const SystemContainer * | getSystemContainer () const |
SystemContainer * | duplicateSystemContainer () |
template<class TypedSystem > | |
TypedSystem * | getSystem () const |
unsigned | frame_id () const |
const std::string & | instance_name () |
void | instance_parent (Instance *parent) |
void | instance_finalize (std::string const &inst_name, ClientMarker const *root_client) |
void | client_register (ClientMarker const *marker) |
void | client_unregister (ClientMarker const *marker) |
void | client_log (ClientMarker const *cm, SrcInfo const &info, LogId id, std::string const &message) |
bool | client_log_enabled (ClientMarker const *cm, LogId id) |
void | debug_print_clients (TextDebugView *view) |
Instance * | Debug_Parent () |
const std::unordered_set< Instance * > & | Debug_Children () |
const ClientMarker * | Debug_RootClient () |
const std::unordered_set< ClientMarker const * > & | Debug_Clients () |
template<class TypedClient > | |
void | Debug_ForeachClient (std::function< void(TypedClient *) > const &lambda) |
Friends | |
class | instance_ptr_interface |
Detailed Description
Definition at line 30 of file Instance.hpp.
Constructor & Destructor Documentation
◆ Instance()
iv::Instance::Instance | ( | const SystemContainer * | sc | ) |
Definition at line 12 of file Instance.cpp.
◆ ~Instance()
|
virtual |
Definition at line 26 of file Instance.cpp.
Member Function Documentation
◆ instance()
|
inline |
Definition at line 36 of file Instance.hpp.
◆ getSystemContainer()
const SystemContainer * iv::Instance::getSystemContainer | ( | ) | const |
Returns SystemContainer given in constructor. Do not use it directly, only Properties and Components should use this to communicate with systems.
Definition at line 102 of file Instance.cpp.
◆ duplicateSystemContainer()
SystemContainer * iv::Instance::duplicateSystemContainer | ( | ) |
SystemContainer of this Instance will be duplicated (to contain the same systems as the original SystemContainer). From now on, all children of this Instance will receive the new SystemContainer in the constructor. This Instance will still use the old SystemContainer. If the SystemContainer is already duplicated, this will just return pointer to it. Instance can change which systems are contained in the new SystemContainer (using the pointer returned from this method).
Call SystemContainer::createProxies after/if you create new systems in that SystemContainer.
Definition at line 107 of file Instance.cpp.
◆ getSystem()
TypedSystem * iv::Instance::getSystem |
Shortcut for getSystemContainer()->getSystem< TypedSystem >().
Definition at line 5 of file Instance.inl.
◆ frame_id()
unsigned iv::Instance::frame_id | ( | ) | const |
Definition at line 56 of file Instance.cpp.
◆ instance_name()
const std::string & iv::Instance::instance_name | ( | ) |
Name for introspection purposes.
Definition at line 169 of file Instance.cpp.
◆ instance_parent()
void iv::Instance::instance_parent | ( | Instance * | parent | ) |
Creates two way relation that is automaticaly cleaned when either Instance is destroyed. Instance can has only one parent, can be nullptr to clear existing relation.
Definition at line 84 of file Instance.cpp.
◆ instance_finalize()
void iv::Instance::instance_finalize | ( | std::string const & | inst_name, |
ClientMarker const * | root_client | ||
) |
Usually assigned right after instantiation. Can be called only once. This finalizes the Instance instanciation, so the instance is registered to InstanceSystem and debug listeners from this method.
Definition at line 61 of file Instance.cpp.
◆ client_register()
void iv::Instance::client_register | ( | ClientMarker const * | marker | ) |
Called automatically from ClientMarker.
Definition at line 128 of file Instance.cpp.
◆ client_unregister()
void iv::Instance::client_unregister | ( | ClientMarker const * | marker | ) |
Definition at line 141 of file Instance.cpp.
◆ client_log()
void iv::Instance::client_log | ( | ClientMarker const * | cm, |
SrcInfo const & | info, | ||
LogId | id, | ||
std::string const & | message | ||
) |
Definition at line 154 of file Instance.cpp.
◆ client_log_enabled()
bool iv::Instance::client_log_enabled | ( | ClientMarker const * | cm, |
LogId | id | ||
) |
Definition at line 161 of file Instance.cpp.
◆ debug_print_clients()
void iv::Instance::debug_print_clients | ( | TextDebugView * | view | ) |
Definition at line 95 of file Instance.cpp.
◆ Debug_Parent()
Instance * iv::Instance::Debug_Parent | ( | ) |
Definition at line 174 of file Instance.cpp.
◆ Debug_Children()
const std::unordered_set< Instance * > & iv::Instance::Debug_Children | ( | ) |
Definition at line 179 of file Instance.cpp.
◆ Debug_RootClient()
const ClientMarker * iv::Instance::Debug_RootClient | ( | ) |
Definition at line 184 of file Instance.cpp.
◆ Debug_Clients()
const std::unordered_set< ClientMarker const * > & iv::Instance::Debug_Clients | ( | ) |
Definition at line 189 of file Instance.cpp.
◆ Debug_ForeachClient()
void iv::Instance::Debug_ForeachClient | ( | std::function< void(TypedClient *) > const & | lambda | ) |
Helper method, iterates over set returned by DebugClientMarkers(), checks type and casts client if type is equal. NOTE - currently unsafe - changes to Instance clients (adding or removing) may corrupt iterators used in this method and cause segfault
- should be refactored in future to support some kind of safe listener based approach
Definition at line 11 of file Instance.inl.
Friends And Related Function Documentation
◆ instance_ptr_interface
|
friend |
Definition at line 138 of file Instance.hpp.
The documentation for this class was generated from the following files:
- ivorium_core/Instancing/Instance.hpp
- ivorium_core/Instancing/Instance.cpp
- ivorium_core/Instancing/Instance.inl