#include <DependencyManager.h>
The build() methods For celix::dm::DependencyManager, celix::dm::Component and celix::dm::(C)ServiceDependency should be called outside the Celix event thread. Note that bundle activators are started and stopped outside the Celix event thread and thus the build() methods can be used in bundle activators.
Inside the Celix event thread - i.e. during a useService callback or add/rem/set call from a service tracker - the buildAsync version should be used. After a buildASync method has returned, service registration and opening service trackers are (possibly) still in progress.
◆ DependencyManager() [1/3]
DependencyManager::DependencyManager |
( |
celix_bundle_context_t * |
ctx | ) |
|
|
inline |
◆ ~DependencyManager()
DependencyManager::~DependencyManager |
( |
| ) |
|
|
inlinevirtual |
◆ DependencyManager() [2/3]
◆ DependencyManager() [3/3]
◆ build()
void DependencyManager::build |
( |
| ) |
|
|
inline |
Build the dependency manager.
When building the dependency manager all created components are build. A build is needed to to enable the components. This is not done automatically so that user can first construct component with their provided service and service dependencies and when to components are complete call the build.
If a component is updated after the dependency manager build is called, an new build call will result in that the changes to the component are enabled.
After this call the components will be created and if the components can be started, they will be started and the services will be registered.
Should not be called from the Celix event thread.
◆ buildAsync()
void DependencyManager::buildAsync |
( |
| ) |
|
|
inline |
Same as build, but this call will not wait until all service registrations and tracker are registered/opened on the Celix event thread. Can be called on the Celix event thread.
◆ bundleContext()
celix_bundle_context_t* celix::dm::DependencyManager::bundleContext |
( |
| ) |
const |
|
inline |
◆ cDependencyManager()
celix_dependency_manager_t* celix::dm::DependencyManager::cDependencyManager |
( |
| ) |
const |
|
inline |
◆ clear()
void DependencyManager::clear |
( |
| ) |
|
|
inline |
Clears the dependency manager, which removes all configured components and waits until all components are removed from the dependency manager.
Should not be called from the Celix event thread.
◆ clearAsync()
void DependencyManager::clearAsync |
( |
| ) |
|
|
inline |
Clears the dependency manager, which removes all configured components.
This is done async and this can be called from the Celix event thread.
◆ createComponent() [1/4]
template<class T >
Component< T > & DependencyManager::createComponent |
( |
std::shared_ptr< T > |
rhs, |
|
|
std::string |
name = std::string{} , |
|
|
std::string |
uuid = {} |
|
) |
| |
Creates and adds a new DM Component for a component of type T and setting the instance using a shared ptr.
- Returns
- Returns a reference to the DM Component
◆ createComponent() [2/4]
template<class T >
std::enable_if< std::is_default_constructible< T >::value, Component< T > & >::type DependencyManager::createComponent |
( |
std::string |
name = std::string{} , |
|
|
std::string |
uuid = {} |
|
) |
| |
|
inline |
Creates and adds a new DM Component for a component of type T.
- Returns
- Returns a reference to the DM Component
◆ createComponent() [3/4]
template<class T >
Component< T > & DependencyManager::createComponent |
( |
std::unique_ptr< T > && |
rhs, |
|
|
std::string |
name = std::string{} , |
|
|
std::string |
uuid = {} |
|
) |
| |
Creates and adds a new DM Component for a component of type T and setting the instance using a unique ptr.
- Returns
- Returns a reference to the DM Component
◆ createComponent() [4/4]
template<class T >
Component< T > & DependencyManager::createComponent |
( |
T |
rhs, |
|
|
std::string |
name = std::string{} , |
|
|
std::string |
uuid = {} |
|
) |
| |
Creates and adds a new DM Component for a component of type T and setting the instance.
- Returns
- Returns a reference to the DM Component
◆ destroyComponent()
void DependencyManager::destroyComponent |
( |
BaseComponent & |
component | ) |
|
|
inline |
Removes a component from the Dependency Manager and wait until the component is destroyed.
The use of removeComponent is preferred.
◆ findComponent()
template<typename T >
std::shared_ptr< Component< T > > DependencyManager::findComponent |
( |
const std::string & |
uuid | ) |
const |
|
inline |
Tries to find the component with UUID and statically cast it to dm component of type T
- Returns
- pointer to found component or null if the component cannot be found.
◆ getInfo()
◆ getInfos()
Get Dependency Management info for all component manager (for all bundles).
- Returns
- A vector of DependencyManagerInfo structs.
◆ getNrOfComponents()
std::size_t DependencyManager::getNrOfComponents |
( |
| ) |
const |
|
inline |
Returns the nr of configured components for this dependency manager.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ removeComponent()
bool DependencyManager::removeComponent |
( |
const std::string & |
uuid | ) |
|
|
inline |
Removes component with provided UUID from the dependency manager and wail until the component is destroyed.
Should not be called from the Celix event thread.
- Returns
- whether the component is found and removed.
◆ removeComponentAsync()
bool DependencyManager::removeComponentAsync |
( |
const std::string & |
uuid | ) |
|
|
inline |
Removes a component from the Dependency Manager and destroys it async.
Can be called from the Celix event thread.
- Returns
- whether the component is found and removed.
◆ start()
void DependencyManager::start |
( |
| ) |
|
|
inline |
Starts the Dependency Manager Note this call is considered deprecated, please use build() instead.
◆ stop()
void DependencyManager::stop |
( |
| ) |
|
|
inline |
Stops the Dependency Manager Note this call is considered deprecated, please use clear() instead.
◆ wait()
void DependencyManager::wait |
( |
| ) |
const |
|
inline |
Wait for an empty Celix event queue.
Should not be called on the Celix event queue thread. Note scheduled events are not part of the event queue.
Can be used to ensure that all created/updated components are completely processed (services registered and/or service trackers are created).
◆ waitIfAble()
void DependencyManager::waitIfAble |
( |
| ) |
const |
|
inline |
Wait (if not called on the Celix event thread) for an empty Celix event queue.
Note scheduled events are not part of the event queue.
Can be used to ensure that all created/updated components are completely processed (services registered and/or service trackers are created).
◆ operator<<
Stream outputs the full dependency manager info.
The documentation for this class was generated from the following files: