Provides the shared storage for registrations.
More...
#include <ServiceLocator.hxx>
|
| static void | clear () |
| | Remove all of the registerations for all types.
|
| |
|
| static void | register_service (string name, shared_ptr< void > &service) |
| | Register a pointer with a name.
|
| |
| static shared_ptr< void > | get_service (string name) |
| | Retrieves a pointer to the registered service, by name.
|
| |
Provides the shared storage for registrations.
Definition at line 76 of file ServiceLocator.hxx.
◆ clear()
| static void ServiceLocatorImpl::clear |
( |
| ) |
|
|
inlinestatic |
Remove all of the registerations for all types.
This is mainly useful for tests.
Definition at line 83 of file ServiceLocator.hxx.
◆ get_service()
| static shared_ptr< void > ServiceLocatorImpl::get_service |
( |
string |
name | ) |
|
|
inlinestaticprivate |
Retrieves a pointer to the registered service, by name.
- Parameters
-
| name | of the service to retrieve |
- Returns
- the retrieved pointer, which is not guaranteed to be of the requested type
Definition at line 110 of file ServiceLocator.hxx.
◆ register_service()
| static void ServiceLocatorImpl::register_service |
( |
string |
name, |
|
|
shared_ptr< void > & |
service |
|
) |
| |
|
inlinestaticprivate |
Register a pointer with a name.
The creator of the class still owns the instance.
- Parameters
-
| name | of the service that you want to register |
| service | is a pointer that you want to register |
Definition at line 98 of file ServiceLocator.hxx.
◆ ServiceLocator
template<typename ServiceType >
◆ lock_
| Atomic ServiceLocatorImpl::lock_ |
|
staticprivate |
◆ services
| std::map< string, shared_ptr< void > > ServiceLocatorImpl::services |
|
staticprivate |
The documentation for this class was generated from the following files: