Apache Celix  2.3.0
An implementation of the OSGi specification adapted to C and C++
Public Member Functions | Static Public Member Functions | List of all members
celix::BundleTracker Class Reference

The BundleTracker class tracks bundles. More...

#include <Trackers.h>

Inheritance diagram for celix::BundleTracker:
Inheritance graph
[legend]
Collaboration diagram for celix::BundleTracker:
Collaboration graph
[legend]

Public Member Functions

void open () override
 
- Public Member Functions inherited from celix::AbstractTracker
 AbstractTracker (std::shared_ptr< celix_bundle_context_t > _cCtx)
 
virtual ~AbstractTracker () noexcept=default
 
bool isOpen () const
 Check if the tracker is open (state == OPEN) More...
 
TrackerState getState () const
 Get the current state of the tracker. More...
 
void close ()
 Close the tracker (of the state is not CLOSED or CLOSING). More...
 
void wait () const
 Wait until a service tracker is completely OPEN or CLOSED. More...
 

Static Public Member Functions

static std::shared_ptr< BundleTrackercreate (std::shared_ptr< celix_bundle_context_t > cCtx, bool includeFrameworkBundle, std::vector< std::function< void(const celix::Bundle &)>> onInstallCallbacks, std::vector< std::function< void(const celix::Bundle &)>> onStartCallbacks, std::vector< std::function< void(const celix::Bundle &)>> onStopCallbacks)
 Creates a new bundle tracker and opens the tracker. More...
 

Additional Inherited Members

- Protected Member Functions inherited from celix::AbstractTracker
void waitIfAble () const
 Wait (if not on the Celix event thread) for the tracker to be OPEN or CLOSED. More...
 
- Static Protected Member Functions inherited from celix::AbstractTracker
template<typename T >
static std::function< void(T *)> delCallback ()
 
- Protected Attributes inherited from celix::AbstractTracker
const std::shared_ptr< celix_bundle_context_t > cCtx
 
std::mutex mutex {}
 
long trkId {-1L}
 
TrackerState state {TrackerState::CLOSED}
 

Detailed Description

The BundleTracker class tracks bundles.

Note
Thread safe.

Member Function Documentation

◆ create()

static std::shared_ptr<BundleTracker> celix::BundleTracker::create ( std::shared_ptr< celix_bundle_context_t >  cCtx,
bool  includeFrameworkBundle,
std::vector< std::function< void(const celix::Bundle &)>>  onInstallCallbacks,
std::vector< std::function< void(const celix::Bundle &)>>  onStartCallbacks,
std::vector< std::function< void(const celix::Bundle &)>>  onStopCallbacks 
)
inlinestatic

Creates a new bundle tracker and opens the tracker.

Parameters
cCtxThe c bundle context.
includeFrameworkBundleWhether the Celix framework bundle should be included in the callbacks.
onInstallCallbacksThe callback which is called for every bundle being installed (also called retroactively for already installed bundles).
onStartCallbacksThe callback which is called for every bundle being started (also called retroactively for already started bundles).
onStopCallbacksThe callback which is called for every bundle being stopped (also called retroactively for already stopped bundles).
Returns
The new bundle tracker as shared ptr.
Exceptions
celix::Exception.

◆ open()

void celix::BundleTracker::open ( )
inlineoverridevirtual

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