|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
Typed service locator for engine subsystems. More...
#include <ServiceRegistry.hpp>
Public Member Functions | |
| ServiceRegistry ()=default | |
| ~ServiceRegistry () | |
| ServiceRegistry (const ServiceRegistry &)=delete | |
| ServiceRegistry & | operator= (const ServiceRegistry &)=delete |
| ServiceRegistry (ServiceRegistry &&) noexcept=default | |
| ServiceRegistry & | operator= (ServiceRegistry &&) noexcept=default |
| template<typename T> | |
| void | registerService (T *service) |
| Registers a borrowed service. | |
| template<typename T> | |
| void | registerOwned (Unique< T > service) |
| Registers an owned service. | |
| template<typename T> | |
| T * | getService () |
| Gets a service by type. | |
| template<typename T> | |
| T & | require () |
| Gets a service by type, asserts non-null. | |
| template<typename T> | |
| void | removeService () |
| Removes and destroys an owned service by type. | |
| void | clear () |
| Removes all services, destroys owned ones in reverse registration order. | |
Typed service locator for engine subsystems.
Allows registering and retrieving subsystems by their C++ type.
Definition at line 47 of file ServiceRegistry.hpp.
|
default |
Referenced by ServiceRegistry(), ServiceRegistry(), operator=(), and operator=().
|
inline |
Definition at line 50 of file ServiceRegistry.hpp.
References clear().
|
delete |
References ServiceRegistry().
|
defaultnoexcept |
References ServiceRegistry().
|
inline |
Removes all services, destroys owned ones in reverse registration order.
Definition at line 141 of file ServiceRegistry.hpp.
Referenced by ~ServiceRegistry().
|
inline |
Gets a service by type.
| T | The service type |
Definition at line 95 of file ServiceRegistry.hpp.
References esengine::serviceTypeId().
Referenced by require().
|
delete |
References ServiceRegistry().
|
defaultnoexcept |
References ServiceRegistry().
|
inline |
Registers an owned service.
| T | The service type |
| service | Unique pointer transferred to the registry |
Definition at line 76 of file ServiceRegistry.hpp.
References ES_ASSERT, and esengine::serviceTypeId().
|
inline |
Registers a borrowed service.
| T | The service type |
| service | Pointer to the service, caller retains ownership |
Definition at line 63 of file ServiceRegistry.hpp.
References ES_ASSERT, registerService(), and esengine::serviceTypeId().
Referenced by registerService().
|
inline |
Removes and destroys an owned service by type.
| T | The service type to remove |
Definition at line 123 of file ServiceRegistry.hpp.
References esengine::serviceTypeId().
|
inline |
Gets a service by type, asserts non-null.
| T | The service type |
Definition at line 107 of file ServiceRegistry.hpp.
References ES_VERIFY_FATAL, and getService().