|
Cogs.Core
|
Service registry. More...
#include <Services.h>
Public Member Functions | |
| Services (Context *context) | |
| void | clear () |
| template<typename Service , typename... Args> | |
| Service * | registerService (Args... args) |
| Registers a service of the given type. | |
| template<typename Service > | |
| void | registerServiceReference (Service *s) |
| Registers an externally managed service instance. | |
| template<typename Service > | |
| Service * | getService () |
| void | addFrameCallback (std::function< void(void)> callback) |
| void | dispatchFrameCallbacks () |
Private Member Functions | |
| bool | ensureUniqueService (Reflection::TypeId typeId) |
| void * | locateService (Reflection::TypeId typeId) |
Private Attributes | |
| std::vector< RegisteredService > | services |
| std::vector< std::function< void(void)> > | callbacks |
| Context * | context |
Service registry.
Provides creation, storage and retrieval of engine services.
Definition at line 31 of file Services.h.
| Cogs::Core::Services::Services | ( | Context * | context | ) |
Definition at line 10 of file Services.cpp.
| Cogs::Core::Services::~Services | ( | ) |
Definition at line 16 of file Services.cpp.
| void Cogs::Core::Services::addFrameCallback | ( | std::function< void(void)> | callback | ) |
Definition at line 34 of file Services.cpp.
| void Cogs::Core::Services::clear | ( | ) |
Definition at line 21 of file Services.cpp.
| void Cogs::Core::Services::dispatchFrameCallbacks | ( | ) |
Definition at line 39 of file Services.cpp.
|
private |
Definition at line 46 of file Services.cpp.
|
inline |
Definition at line 94 of file Services.h.
|
private |
Definition at line 57 of file Services.cpp.
|
inline |
Registers a service of the given type.
An instance of the Service class is automatically created, and returned from subsequent calls to getService<Service>().
| Service | Type of service to register. Must be registered with the type system. |
| Args | Types of the arguments to pass to the constructor. |
| args | Arguments to pass to the instance constructor. |
Definition at line 53 of file Services.h.
References Cogs::Core::Context::memory.
|
inline |
Registers an externally managed service instance.
Definition at line 78 of file Services.h.
|
private |
Definition at line 109 of file Services.h.
|
private |
Definition at line 111 of file Services.h.
|
private |
Definition at line 108 of file Services.h.