Apache Celix
2.4.0
Apache Celix is a framework for C, C++14 and C++17 to develop dynamic modular software applications using component and in-process service-oriented programming.
|
Go to the documentation of this file.
20 #ifndef CELIX_COMPONENT_H_
21 #define CELIX_COMPONENT_H_
25 #include "celix_types.h"
26 #include "celix_errno.h"
27 #include "celix_properties.h"
28 #include "celix_array_list.h"
30 #include "celix_framework_export.h"
36 #define CELIX_DM_COMPONENT_UUID "component.uuid"
61 #define CELIX_DM_COMPONENT_MAX_ID_LENGTH 64
62 #define CELIX_DM_COMPONENT_MAX_NAME_LENGTH 128
71 CELIX_FRAMEWORK_EXPORT celix_dm_component_t*
celix_dmComponent_create(celix_bundle_context_t *context,
const char* name);
110 CELIX_FRAMEWORK_EXPORT celix_status_t
celix_dmComponent_addInterface(celix_dm_component_t *component,
const char* serviceName,
const char* serviceVersion,
const void* service, celix_properties_t *properties);
138 #define CELIX_DM_COMPONENT_SET_IMPLEMENTATION_DESTROY_FUNCTION(dmCmp, type, destroy) \
140 void (*_destroyFunction)(type*) = (destroy); \
141 celix_dmComponent_setImplementationDestroyFunction((dmCmp), (void(*)(void*))_destroyFunction); \
193 #define CELIX_DM_COMPONENT_SET_CALLBACKS(dmCmp, type, init, start, stop, deinit) \
195 int (*_tmp_init)(type*) = (init); \
196 int (*_tmp_start)(type*) = (start); \
197 int (*_tmp_stop)(type*) = (stop); \
198 int (*_tmp_deinit)(type*) = (deinit); \
199 celix_dmComponent_setCallbacks((dmCmp), (celix_dm_cmp_lifecycle_fpt)_tmp_init, (celix_dm_cmp_lifecycle_fpt)_tmp_start, (celix_dm_cmp_lifecycle_fpt)_tmp_stop, (celix_dm_cmp_lifecycle_fpt)_tmp_deinit); \
214 #define CELIX_DMCOMPONENT_SETCALLBACKS(dmCmp, type, init, start, stop, deinit) \
215 CELIX_DM_COMPONENT_SET_CALLBACKS(dmCmp, type*, init, start, stop, deinit)
@ CELIX_DM_CMP_STATE_INITIALIZED_AND_WAITING_FOR_REQUIRED
Definition: celix_dm_component.h:43
CELIX_FRAMEWORK_EXPORT void celix_dmComponent_destroy(celix_dm_component_t *cmp)
CELIX_FRAMEWORK_EXPORT void celix_dmComponent_destroyComponentInfo(dm_component_info_pt info)
CELIX_FRAMEWORK_EXPORT void celix_dmComponent_destroyAsync(celix_dm_component_t *cmp, void *doneData, void(*doneCallback)(void *))
CELIX_FRAMEWORK_EXPORT celix_status_t celix_dmComponent_setImplementation(celix_dm_component_t *component, void *implementation)
@ CELIX_DM_CMP_STATE_WAITING_FOR_REQUIRED
Definition: celix_dm_component.h:40
@ CELIX_DM_CMP_STATE_SUSPENDING
Definition: celix_dm_component.h:47
@ CELIX_DM_CMP_STATE_TRACKING_OPTIONAL
Definition: celix_dm_component.h:46
@ CELIX_DM_CMP_STATE_INACTIVE
Definition: celix_dm_component.h:39
CELIX_FRAMEWORK_EXPORT celix_status_t celix_dmComponent_getComponentInfo(celix_dm_component_t *component, celix_dm_component_info_t **infoOut)
@ CELIX_DM_CMP_STATE_SUSPENDED
Definition: celix_dm_component.h:48
void(* celix_dm_cmp_impl_destroy_fpt)(void *)
Definition: celix_dm_component.h:65
CELIX_FRAMEWORK_EXPORT celix_status_t celix_dmComponent_removeServiceDependency(celix_dm_component_t *component, celix_dm_service_dependency_t *dependency)
int(* celix_dm_cmp_lifecycle_fpt)(void *userData)
Definition: celix_dm_component.h:64
CELIX_FRAMEWORK_EXPORT celix_dm_component_t * celix_dmComponent_create(celix_bundle_context_t *context, const char *name)
@ CELIX_DM_CMP_STATE_RESUMING
Definition: celix_dm_component.h:49
CELIX_FRAMEWORK_EXPORT celix_dm_cmp_impl_destroy_fpt celix_dmComponent_getImplementationDestroyFunction(celix_dm_component_t *cmp)
@ DM_CMP_STATE_WAITING_FOR_REQUIRED
Definition: celix_dm_component.h:56
const CELIX_FRAMEWORK_EXPORT char * celix_dmComponent_getUUID(celix_dm_component_t *cmp)
CELIX_FRAMEWORK_EXPORT celix_status_t celix_dmComponent_getInterfaces(celix_dm_component_t *component, celix_array_list_t **servicesNames)
@ CELIX_DM_CMP_STATE_STARTING
Definition: celix_dm_component.h:44
CELIX_FRAMEWORK_EXPORT void celix_dmComponent_setImplementationDestroyFunction(celix_dm_component_t *cmp, celix_dm_cmp_impl_destroy_fpt destroyFn)
CELIX_FRAMEWORK_DEPRECATED_EXPORT celix_status_t celix_dmComponent_setCLanguageProperty(celix_dm_component_t *component, bool setCLangProp)
CELIX_FRAMEWORK_EXPORT celix_status_t celix_dmComponent_addServiceDependency(celix_dm_component_t *component, celix_dm_service_dependency_t *dep)
CELIX_FRAMEWORK_EXPORT celix_dm_component_state_t celix_dmComponent_currentState(celix_dm_component_t *cmp)
@ DM_CMP_STATE_TRACKING_OPTIONAL
Definition: celix_dm_component.h:58
CELIX_FRAMEWORK_EXPORT bool celix_dmComponent_isActive(celix_dm_component_t *component)
CELIX_FRAMEWORK_EXPORT void celix_dmComponent_printComponentInfo(celix_dm_component_info_t *info, bool printFullInfo, bool useAnsiColors, FILE *stream)
CELIX_FRAMEWORK_EXPORT celix_status_t celix_dmComponent_addInterface(celix_dm_component_t *component, const char *serviceName, const char *serviceVersion, const void *service, celix_properties_t *properties)
@ CELIX_DM_CMP_STATE_STOPPING
Definition: celix_dm_component.h:45
CELIX_FRAMEWORK_EXPORT celix_status_t celix_dmComponent_removeInterface(celix_dm_component_t *component, const void *service)
const CELIX_FRAMEWORK_EXPORT char * celix_dmComponent_getName(celix_dm_component_t *cmp)
CELIX_FRAMEWORK_EXPORT celix_status_t celix_dmComponent_setCallbacks(celix_dm_component_t *component, celix_dm_cmp_lifecycle_fpt init, celix_dm_cmp_lifecycle_fpt start, celix_dm_cmp_lifecycle_fpt stop, celix_dm_cmp_lifecycle_fpt deinit)
CELIX_FRAMEWORK_EXPORT void * celix_dmComponent_getImplementation(celix_dm_component_t *cmp)
Definition: celix_dm_info.h:53
@ DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED
Definition: celix_dm_component.h:57
CELIX_FRAMEWORK_EXPORT celix_dm_component_t * celix_dmComponent_createWithUUID(celix_bundle_context_t *context, const char *name, const char *UUID)
const CELIX_FRAMEWORK_EXPORT char * celix_dmComponent_stateToString(celix_dm_component_state_t state)
@ CELIX_DM_CMP_STATE_INITIALIZING
Definition: celix_dm_component.h:41
CELIX_FRAMEWORK_EXPORT celix_bundle_context_t * celix_dmComponent_getBundleContext(celix_dm_component_t *component)
@ CELIX_DM_CMP_STATE_DEINITIALIZING
Definition: celix_dm_component.h:42
enum celix_dm_component_state_enum celix_dm_component_state_t
@ DM_CMP_STATE_INACTIVE
Definition: celix_dm_component.h:55
celix_dm_component_state_enum
Definition: celix_dm_component.h:38