hololink::module::Module
hololink::module::Module
Module encapsulates a set of services, normally associated with a specific HSB implementation.
The group of services for a specific Module are normally implemented in a single shared object file, but an application also provides a Module instance that encapsulates services that those loaded modules will use (e.g. Logging).
Applications hold a std::shared_ptr<``Module``> and pass it to the type-safe get_service function of the interface they want (e.g. Service<T>::get_service), which calls Module::get_service and returns a correctly typed pointer.
A service returned from a Module remains valid for as long as the caller holds it, independent of how long the caller keeps the Module itself.
Inherits from: std::enable_shared_from_this< Module > (public)
Methods
get_service
Look up a service by its untyped identifiers.
This is the untyped lookup that the type-safe get_service functions are built on; applications always call those instead. If a service matching both identifiers is available, it is returned; repeated calls with the same identifiers may return the same instance. A service that has not been used before may be created by the module as part of the lookup.
Returns: The service, as a type-erased pointer to the object registered under type_id, or nullptr when it is not found and allow_null is true.
Throws: std::runtime_error if instance_id or type_id is null, or if the service is not found and allow_null is false.
Parameters
Names the specific service instance; its format is defined by the service type.
Names the type of the service interface, corresponding with the ‘type_id’ member of a Service class (e.g. "mipi_dphy.v1").
If false (the default), a service that cannot be found causes a std::runtime_error to be thrown. If true, an empty pointer is returned instead.