RTC Toolkit
1.0.0
|
Container class that holds services of any type. More...
#include <serviceContainer.hpp>
Public Member Functions | |
template<typename Service > | |
void | Add (Service &&service, const std::string &name="") |
Insert new service into the container. More... | |
template<typename Service > | |
void | Add (std::shared_ptr< Service > service, const std::string &name="") |
Insert new service into the container. More... | |
template<typename Service > | |
Service & | Get (const std::string &name="") |
Get a handle to a service. More... | |
template<typename Service > | |
bool | Contains (const std::string &name="") |
Check if the service container holds a certain service. More... | |
std::vector< std::string > | List () |
List currently available services. More... | |
Container class that holds services of any type.
The class holds 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
|
inline |
Insert new service into the container.
This overload is used to add non-pointer type serives, 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 serives, 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 |
|
inline |
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 |
|
inline |
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.