|
RTC Toolkit 5.1.0
|
Container class that holds services of any type. More...
#include <rtctk/componentFramework/serviceContainer.hpp>
Public Member Functions | |
| ServiceContainer ()=default | |
| ServiceContainer (const ServiceContainer &other)=delete | |
| ServiceContainer & | operator= (const ServiceContainer &other)=delete |
| ServiceContainer (const ServiceContainer &&other)=delete | |
| ServiceContainer & | operator= (ServiceContainer &&other)=delete |
| ~ServiceContainer () | |
| template<typename Service > | |
| void | Add (Service &&service, const std::string &name="") |
| Insert new service into the container. | |
| template<typename Service > | |
| void | Add (std::shared_ptr< Service > service, const std::string &name="") |
| Insert new service into the container. | |
| template<typename Service > | |
| Service & | Get (const std::string &name="") |
| Get a handle to a service. | |
| template<typename Service > | |
| bool | Contains (const std::string &name="") |
| Check if the service container holds a certain service. | |
| std::vector< std::string > | List () |
| List currently available services. | |
Container class that holds services of any type.
The class owns services which are identified by their type and name. Multiple services can be registered for a certain type. Users may request handles to these services.
Polymorphic services can be added as a specific type and retrieved as a generic type.
|
default |
|
delete |
|
delete |
| rtctk::componentFramework::ServiceContainer::~ServiceContainer | ( | ) |
|
inline |
Insert new service into the container.
This overload is used to add non-pointer type services, which are moved into the container.
| Service,type | of the service. |
| service | rvalue ref to the service. |
| name | name of the service. |
| rtctk::componentFramework::RtctkException | if service already registered |
|
inline |
Insert new service into the container.
This overload is used to add shared_pointer type services, which are copied into the container.
| Service,type | of the service. |
| service | rvalue ref to the service. |
| name | name of the service. |
| rtctk::componentFramework::RtctkException | if service already registered |
Check if the service container holds a certain service.
| Service,type | of the service. |
| name | optional: name of the service, if only 1 service of type Service is present, this argument can be ommited |
Get a handle to a service.
| Service,type | of the service. |
| name | optional: name of the service, if only 1 service of type Service is present, this argument can be ommited |
| rtctk::componentFramework::RtctkException | if service not found |
| std::vector< std::string > rtctk::componentFramework::ServiceContainer::List | ( | ) |
List currently available services.
|
delete |
|
delete |