Medical Imaging Interaction Toolkit
2024.06.00
Medical Imaging Interaction Toolkit
|
#include <usServiceObjects.h>
Public Member Functions | |
S * | GetService () const |
void | UngetService (S *service) |
ServiceReference< S > | GetServiceReference () const |
Allows multiple service objects for a service to be obtained.
For services with prototype scope, multiple service objects for the service can be obtained. For services with singleton or module scope, only one, use-counted service object is available. Any unreleased service objects obtained from this ServiceObjects object are automatically released by the framework when the modules associated with the ModuleContext used to create this ServiceObjects object is stopped.
S | Type of Service. |
Definition at line 86 of file usServiceObjects.h.
|
inline |
Returns a service object for the referenced service.
This ServiceObjects object can be used to obtain multiple service objects for the referenced service if the service has prototype scope. If the referenced service has singleton or module scope, this method behaves the same as calling the ModuleContext::GetService(const ServiceReferenceBase&) method for the referenced service. That is, only one, use-counted service object is available from this ServiceObjects object.
This method will always return nullptr
when the referenced service has been unregistered.
For a prototype scope service, the following steps are taken to get the service object:
nullptr
is returned. nullptr
is returned and a warning message is issued. nullptr
if the service is not registered, the service object returned by a ServiceFactory does not contain all the classes under which it was registered or the ServiceFactory threw an exception.std::logic_error | If the ModuleContext used to create this ServiceObjects object is no longer valid. |
Definition at line 127 of file usServiceObjects.h.
|
inline |
Returns the ServiceReference for this ServiceObjects object.
Definition at line 173 of file usServiceObjects.h.
|
inline |
Releases a service object for the referenced service.
This ServiceObjects object can be used to obtain multiple service objects for the referenced service if the service has prototype scope. If the referenced service has singleton or module scope, this method behaves the same as calling the ModuleContext::UngetService(const ServiceReferenceBase&) method for the referenced service. That is, only one, use-counted service object is available from this ServiceObjects object.
For a prototype scope service, the following steps are take to release the service object:
service | A service object previously provided by this ServiceObjects object. |
std::logic_error | If the ModuleContext used to create this ServiceObjects object is no longer valid. |
std::invalid_argument | If the specified service was not provided by this ServiceObjects object. |
Definition at line 163 of file usServiceObjects.h.