Go to the source code of this file.
◆ CELIX_GEN_CXX_BUNDLE_ACTIVATOR
#define CELIX_GEN_CXX_BUNDLE_ACTIVATOR |
( |
|
actType | ) |
|
Value:extern "C" celix_status_t bundleActivator_create(celix_bundle_context_t *context, void** userData) { \
return celix::impl::createActivator<actType>(context, userData); \
} \
\
extern "C" celix_status_t bundleActivator_start(void *, celix_bundle_context_t *) { \
\
return CELIX_SUCCESS; \
} \
\
extern "C" celix_status_t bundleActivator_stop(void *userData, celix_bundle_context_t*) { \
return celix::impl::destroyActivator<actType>(userData); \
} \
\
extern "C" celix_status_t bundleActivator_destroy(void *, celix_bundle_context_t*) { \
\
return CELIX_SUCCESS; \
}
Macro to generate the required bundle activator functions for C++. This can be used to more type safe bundle activator entries.
The macro will create the following bundle activator C functions:
- bundleActivator_create, which will create the required C++ object (bundle context and dependency manager) and create the C++ bundle activator class (RAII)
- bundleActivator_start function, which for C++ will do nothing.
- bundleActivator_stop function, which will trigger the destruction of the C++ BundleActivator and ensure that there is no dangling usage of the bundle context and/or dependency manager.
- bundleActivator_destroy function, which for C++ will do nothing.
The destruction of the C++ BundleActivator is triggered in the bundleActivator_stop instead of bundleActivator_destroy to ensure that the C++ dependency manager does is cleanup before the C dependency manager. This is needed, because the C dependency manager is not aware of "above lying" C++ objects.
- Parameters
-
type | The activator type (e.g. 'ShellActivator'). A type which should have a constructor with a single argument of std::shared_ptr<celix::BundleContext> or std::shared_ptr<DependencyManager>. |