template<class S>
class ServiceObjects< S >
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.
- Template Parameters
-
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:
-
If the referenced service has been unregistered,
NULL
is returned.
-
The PrototypeServiceFactory::GetService(Module*, const ServiceRegistrationBase&) method is called to create a service object for the caller.
-
If the service object (an instance of InterfaceMap) returned by the PrototypeServiceFactory object is empty, does not contain all the interfaces named when the service was registered or the PrototypeServiceFactory object throws an exception,
NULL
is returned and a warning message is issued.
-
The service object is returned.
- Returns
- A service object for the referenced service or
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.
- Exceptions
-
- See Also
- UngetService()
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:
-
If the referenced service has been unregistered,
NULL
is returned.
-
The PrototypeServiceFactory::GetService(Module*, const ServiceRegistrationBase&) method is called to create a service object for the caller.
-
If the service object (an instance of InterfaceMap) returned by the PrototypeServiceFactory object is empty, does not contain all the interfaces named when the service was registered or the PrototypeServiceFactory object throws an exception,
NULL
is returned and a warning message is issued.
-
The service object is returned.
- Returns
- A service object for the referenced service or
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.
- Exceptions
-
- See Also
- UngetService()
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:
-
If the referenced service has been unregistered,
NULL
is returned.
-
The PrototypeServiceFactory::GetService(Module*, const ServiceRegistrationBase&) method is called to create a service object for the caller.
-
If the service object (an instance of InterfaceMap) returned by the PrototypeServiceFactory object is empty, does not contain all the interfaces named when the service was registered or the PrototypeServiceFactory object throws an exception,
NULL
is returned and a warning message is issued.
-
The service object is returned.
- Returns
- A service object for the referenced service or
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.
- Exceptions
-
- See Also
- UngetService()