#include <SystemContainer.hpp>
Public Member Functions | |
SystemContainer () | |
SystemContainer (SystemContainer const *sc) | |
~SystemContainer () | |
void | debug_print (TextDebugView *view) const |
const std::unordered_map< std::type_index, System * > & | debug_GetSystems () const |
bool | flushSystems () |
void | nextFrame () |
unsigned | frame_id () const |
template<class TypedSystem > | |
TypedSystem * | getSystem () const |
System * | getSystem (std::type_index type) const |
template<class TypedSystem , typename... Args> | |
TypedSystem * | createOwnSystem (Args... constructor_arguments) |
template<class TypedSystem > | |
TypedSystem * | addForeignSystem (TypedSystem *system) |
template<class TypedSystem > | |
void | removeSystem () |
Detailed Description
If multiple SystemContainers contain the same instance of a system, the system will be deleted after last of those SystemContainers is deleted, no matter which created it.
Definition at line 55 of file SystemContainer.hpp.
Constructor & Destructor Documentation
◆ SystemContainer() [1/2]
iv::SystemContainer::SystemContainer | ( | ) |
Creates empty SystemContainer.
Definition at line 56 of file SystemContainer.cpp.
◆ SystemContainer() [2/2]
iv::SystemContainer::SystemContainer | ( | SystemContainer const * | sc | ) |
Copies pointers to systems from given SystemContainer.
Definition at line 63 of file SystemContainer.cpp.
◆ ~SystemContainer()
iv::SystemContainer::~SystemContainer | ( | ) |
Deallocates all owned systems.
Definition at line 75 of file SystemContainer.cpp.
Member Function Documentation
◆ debug_print()
void iv::SystemContainer::debug_print | ( | TextDebugView * | view | ) | const |
Definition at line 134 of file SystemContainer.cpp.
◆ debug_GetSystems()
const std::unordered_map< std::type_index, System * > & iv::SystemContainer::debug_GetSystems | ( | ) | const |
Only for debug purposes (essentialy just to call System::debug_print on them).
Definition at line 114 of file SystemContainer.cpp.
◆ flushSystems()
bool iv::SystemContainer::flushSystems | ( | ) |
System::flushSystem will be called on all systems repeatedly until all systems return false from the flush. This guarantees that all systems will do all their updates and everything will be in stable state (no need for any more updates until next frame).
Definition at line 119 of file SystemContainer.cpp.
◆ nextFrame()
void iv::SystemContainer::nextFrame | ( | ) |
Definition at line 82 of file SystemContainer.cpp.
◆ frame_id()
unsigned iv::SystemContainer::frame_id | ( | ) | const |
Definition at line 99 of file SystemContainer.cpp.
◆ getSystem() [1/2]
TypedSystem * iv::SystemContainer::getSystem |
Returns system that was inserted into SystemContainer with the same type.
Definition at line 5 of file SystemContainer.inl.
◆ getSystem() [2/2]
System * iv::SystemContainer::getSystem | ( | std::type_index | type | ) | const |
Same as templated version but needs just std::type_index and not compile-time type of system and returns only interface of the system.
Definition at line 104 of file SystemContainer.cpp.
◆ createOwnSystem()
TypedSystem * iv::SystemContainer::createOwnSystem | ( | Args... | constructor_arguments | ) |
Create system that will be owned by this SystemContainer. If foreign system exists in this SC, then it will be unlinked and new own will be created. If own system already exists, it will be just returned and constructor_arguments
will not be used.
Definition at line 30 of file SystemContainer.inl.
◆ addForeignSystem()
TypedSystem * iv::SystemContainer::addForeignSystem | ( | TypedSystem * | system | ) |
Add system to this SystemContainer. This is used mainly when cloning SystemContainer to let it use the same systems as parent uses. If this system (either own or foreign) exists, nothing will be changed and current system will be returned;
Definition at line 66 of file SystemContainer.inl.
◆ removeSystem()
void iv::SystemContainer::removeSystem |
Removes system from the SystemContainer. If the system was owned by this SystemContainer, then it will be destroyed.
Definition at line 90 of file SystemContainer.inl.
The documentation for this class was generated from the following files:
- ivorium_core/Instancing/SystemContainer.hpp
- ivorium_core/Instancing/SystemContainer.cpp
- ivorium_core/Instancing/SystemContainer.inl