![]() |
Carousel
|
The ServiceLocator class provides default implementation of the central registry of the services. More...
#include <ServiceLocator.h>
Inherits IServiceLocator.
Public Member Functions | |
QObject * | buildObject (const QString &className) |
QObject * | buildObject (const QString &className, const QString &tag) |
QObject * | locateToObject (const QString &className) |
QObject * | locateToObject (const QString &className, const QString &tag) |
QStringList | services () const |
Gets the services, registered with an empty tag. More... | |
QStringList | services (const QString &tag) const |
Gets the registered with tag services;. More... | |
![]() | |
template<typename TInterface , typename TConcreteClass > | |
void | bindType (const QString &tag) |
template<typename TInterface , typename TConcreteClass > | |
void | bindType () |
template<typename TInterface > | |
TInterface * | buildInstance () |
template<typename TInterface > | |
TInterface * | buildInstance (const QString &tag) |
template<typename TService > | |
TService * | locate () |
template<typename TService > | |
TService * | locate (const QString &tag) |
template<typename TService > | |
void | registerInstance (TService *instance) |
template<typename TService > | |
void | registerInstance (TService *instance, const QString &tag) |
template<typename TInterface > | |
void | registerType (factoryMethod method) |
template<typename TInterface > | |
void | registerType (factoryMethod method, const QString &tag) |
template<typename TService > | |
TService * | unregisterInstance (const QString &tag) |
template<typename TService > | |
TService * | unregisterInstance () |
Protected Member Functions | |
void * | buildInstanceImpl (const QString &className, const QString &tag) |
void * | getService (const QString &className, const QString &tag) |
void | registerInstanceImpl (void *instance, const QString &className, const QString &tag) |
void | registerTypeImpl (const QString &className, factoryMethod method, const QString &tag) |
void * | unregisterInstanceImpl (const QString &className, const QString &tag) |
Protected Attributes | |
TypeObjectsMap< factoryMethod > * | m_creators |
TypeObjectsMap< void * > * | m_objects |
The ServiceLocator class provides default implementation of the central registry of the services.
It is a utility class and you won't use often in trivial - use IServiceLocator interface instead. The ServiceLocator instance created by default by the BootloaderBase::createServiceLocator() member during the loading sequence, and you should to override this member if you want use your own service locator in the application.
Creates and returns a className pointer using empty tag and registered factory method, if any. Returns nullptr otherwise. This may be usefull for scpipting, where no templates.
Implements IServiceLocator.
Creates and returns a className pointer using specified tag and registered factory method, if any. Returns nullptr otherwise. This may be usefull for scpipting, where no templates.
Implements IServiceLocator.
Finds the service registered with className and empty tag and returns a QObject pointer to it. This may be usefull for scpipting, where no templates.
Implements IServiceLocator.
Finds the service registered with className and empty tag and returns a QObject pointer to it. This may be usefull for scpipting, where no templates.
Implements IServiceLocator.
|
virtual |
Gets the services, registered with an empty tag.
Implements IServiceLocator.
|
virtual |
Gets the registered with tag services;.
Implements IServiceLocator.
|
protectedvirtual |
When overridden in derived classes finds the factory method associated with specified type id and specified tag in inner objects dictionary and creates instance of the interface using factory method
Implements IServiceLocator.
|
protectedvirtual |
Finds the pointer associated with specified type id and specified tag in inner objects dictionary.
Implements IServiceLocator.
|
protectedvirtual |
Registers a raw pointer with specified tag in inner objects dictionary.
className | The name of type which instance should be associated with. |
Implements IServiceLocator.
|
protectedvirtual |
Binds an interface type id with specified factory method (that should create instance of interface) and with specified tag in inner objects dictionary.
className | The name of type which factory method should be associated with. |
Implements IServiceLocator.
|
protectedvirtual |
When overridden in derived classes unregisters (removes) a service instance with specified type id and tag from the inner objects dictionary (if any).
className | The name of type which removed instance should be associated with. |
Implements IServiceLocator.