Celix  2.2.0
An implementation of the OSGi specification adapted to C and C++
Public Attributes | List of all members
celix_service_registration_options Struct Reference

#include <celix_bundle_context.h>

Public Attributes

void *svc OPTS_INIT
 
celix_service_factory_t *factory OPTS_INIT
 
const char *serviceName OPTS_INIT
 
celix_properties_t *properties OPTS_INIT
 
const char *serviceLanguage OPTS_INIT
 
const char *serviceVersion OPTS_INIT
 

Detailed Description

Service Registration Options when registering services to the Celix framework.

Member Data Documentation

void* svc celix_service_registration_options::OPTS_INIT

The service pointer. The actual pointer to the service. For C this is normally a pointer to a struct with function pointers, but theoretically this can be a pointer to anything (e.g. a pointer to a single function, or a pointer to a C++ interface implementation, or just a pointer to a data structure).

The bundle is responsible to keep the service pointer valid as long as it is registered in the Celix framework.

celix_service_factory_t* factory celix_service_registration_options::OPTS_INIT

The service factory pointer. Note if the factory service is set, the svc field will not be used.

The service factory will be called for every bundle requesting/de-requesting a service. This gives the provider the option to create bundle specific service instances.

When a service is requested for a bundle the getService of the factory service will be called. This function must return a valid pointer to a service conform the registered service name or NULL. When a service in no longer needed for a bundle (e.g. ending the useService(s) calls when a service tacker is stopped) the ungetService function of the service factory will be called.

The bundle is responsible to keep the service factory pointer valid as long as it is registered in the Celix framework.

const char* serviceName celix_service_registration_options::OPTS_INIT

The required service name. This is used to identify the service. A fully qualified name with a namespace is advisable to prevent name collision. (e.g. EXAMPLE_PRESSURE_SENSOR).

celix_properties_t* properties celix_service_registration_options::OPTS_INIT

The optional service properties. These contain meta information about the service in the form of string key/values. (e.g. the location of a pressure sensor: location=left-tire).

When a service is registered the Celix framework will take ownership of the provided properties. If a registration fails, the properties will be destroyed (freed) by the Celix framework.

const char* serviceLanguage celix_service_registration_options::OPTS_INIT

The optional service language. If this is NULL, CELIX_FRAMEWORK_SERVICE_LANGUAGE_C is used.

const char* serviceVersion celix_service_registration_options::OPTS_INIT

The optional service version (in the form of <MAJOR>.<MINOR>.<MICRO>.<QUALIFIER>). If present consumer of the service can specific which service version range of a specific service they are interested in. Note that it is the responsibility of the users to ensure that service in those version range are compatible (binary of source). It is advisable to use semantic versioning for this.


The documentation for this struct was generated from the following file: