Allows multiple service objects for a service to be obtained. More...
Public Member Functions | |
S * | GetService () const |
Returns a service object for the referenced service. More... | |
void | UngetService (S *service) |
Releases a service object for the referenced service. More... | |
ServiceReference< S > | GetServiceReference () const |
Returns the ServiceReference for this ServiceObjects object. More... | |
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. |
|
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 NULL
when the referenced service has been unregistered.
For a prototype scope service, the following steps are taken to get the service object:
NULL
is returned. NULL
is returned and a warning message is issued. NULL
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. |
|
inline |
Returns the ServiceReference for this ServiceObjects object.
|
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. |