Medical Imaging Interaction Toolkit
2024.06.00
Medical Imaging Interaction Toolkit
|
#include <usServiceFactory.h>
Public Member Functions | |
virtual | ~ServiceFactory () |
virtual InterfaceMap | GetService (Module *module, const ServiceRegistrationBase ®istration)=0 |
virtual void | UngetService (Module *module, const ServiceRegistrationBase ®istration, const InterfaceMap &service)=0 |
A factory for module scope services. The factory can provide service objects unique to each module.
When registering a service, a ServiceFactory
object can be used instead of a service object, so that the module developer can gain control of the specific service object granted to a module that is using the service.
When this happens, the ModuleContext::GetService(const ServiceReference&)
method calls the ServiceFactory::GetService
method to create a service object specifically for the requesting module. The service object returned by the ServiceFactory
is cached by the framework until the module releases its use of the service.
When the module's use count for the service equals zero (including the module unloading or the service being unregistered), the ServiceFactory::UngetService
method is called.
ServiceFactory
objects are only used by the framework and are not made available to other modules in the module environment. The framework may concurrently call a ServiceFactory
.
Definition at line 64 of file usServiceFactory.h.
|
inlinevirtual |
Definition at line 69 of file usServiceFactory.h.
|
pure virtual |
Creates a new service object.
The Framework invokes this method the first time the specified module
requests a service object using the ModuleContext::GetService(const ServiceReferenceBase&)
method. The service factory can then return a specific service object for each module.
The framework caches the value returned (unless the InterfaceMap is empty), and will return the same service object on any future call to ModuleContext::GetService
for the same modules. This means the framework does not allow this method to be concurrently called for the same module.
module | The module using the service. |
registration | The ServiceRegistrationBase object for the service. |
Implemented in us::PrototypeServiceFactory.
|
pure virtual |
Releases a service object.
The framework invokes this method when a service has been released by a module. The service object may then be destroyed.
module | The Module releasing the service. |
registration | The ServiceRegistration object for the service. |
service | The service object returned by a previous call to the ServiceFactory::GetService method. |
Implemented in us::PrototypeServiceFactory.