A registered service.
More...
#include <ServiceRegistration.h>
|
static std::shared_ptr< ServiceRegistration > | create (std::shared_ptr< celix_bundle_context_t > cCtx, std::shared_ptr< void > svc, const std::string &name, const std::string &version, celix::Properties properties, bool registerAsync, bool unregisterAsync, std::vector< std::function< void(ServiceRegistration &)>> onRegisteredCallbacks, std::vector< std::function< void(ServiceRegistration &)>> onUnregisteredCallbacks) |
|
A registered service.
Represent a registered service. If the ServiceRegistration is destroy the underlining service is unregistered in the Celix framework.
- Note
- Thread safe.
◆ create()
static std::shared_ptr<ServiceRegistration> celix::ServiceRegistration::create |
( |
std::shared_ptr< celix_bundle_context_t > |
cCtx, |
|
|
std::shared_ptr< void > |
svc, |
|
|
const std::string & |
name, |
|
|
const std::string & |
version, |
|
|
celix::Properties |
properties, |
|
|
bool |
registerAsync, |
|
|
bool |
unregisterAsync, |
|
|
std::vector< std::function< void(ServiceRegistration &)>> |
onRegisteredCallbacks, |
|
|
std::vector< std::function< void(ServiceRegistration &)>> |
onUnregisteredCallbacks |
|
) |
| |
|
inlinestatic |
- Parameters
-
cCtx | The C bundle context. |
svc | The service (shared ptr) to register |
name | The name of the service (objectClass) for the registration. |
version | The optional version of the service. |
properties | The meta properties to register with to the service. |
registerAsync | Whether the registration will be done async. |
unregisterAsync | Whether the un-registration will be done async. |
onRegisteredCallbacks | The callback which will be called when the service is registered. |
onUnregisteredCallbacks | The callback wich will be called when the service is unregistered. |
- Returns
- The new ServiceRegistration object as shared ptr.
- Exceptions
-
◆ getSelf()
Returns the shared_ptr of for this object.
This method can return null when the ServiceRegistration in UNREGISTERED.
◆ getServiceId()
long celix::ServiceRegistration::getServiceId |
( |
| ) |
const |
|
inline |
The service id for this service registration.
◆ getServiceName()
const std::string& celix::ServiceRegistration::getServiceName |
( |
| ) |
const |
|
inline |
The service name for this service registration.
◆ getServiceProperties()
const celix::Properties& celix::ServiceRegistration::getServiceProperties |
( |
| ) |
const |
|
inline |
The service properties for this service registration.
◆ getServiceRanking()
long celix::ServiceRegistration::getServiceRanking |
( |
| ) |
const |
|
inline |
The service ranking for this service registration.
◆ getServiceVersion()
const std::string& celix::ServiceRegistration::getServiceVersion |
( |
| ) |
const |
|
inline |
The service version for this service registration.
Empty string if there is no service version.
◆ getState()
The state of the service registration.
◆ unregister()
void celix::ServiceRegistration::unregister |
( |
| ) |
|
|
inline |
Unregister the service from the Celix framework if the state is REGISTERED.
If ServiceRegistration::unregisterAsync is true still will be done async, if not this will be done synchronized.
◆ wait()
void celix::ServiceRegistration::wait |
( |
| ) |
const |
|
inline |
If the service registration is REGISTERING or UNREGISTERING, wait until state is REGISTERED OR UNREGISTERED.
The documentation for this class was generated from the following file: