Apache Celix  latest
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.
Public Member Functions | Static Public Member Functions | List of all members
celix::MetaTracker Class Reference

The MetaTracker track service trackers. More...

#include <Trackers.h>

Inheritance diagram for celix::MetaTracker:
Inheritance graph
[legend]
Collaboration diagram for celix::MetaTracker:
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< MetaTrackercreate (std::shared_ptr< celix_bundle_context_t > cCtx, std::string serviceName, std::vector< std::function< void(const ServiceTrackerInfo &)>> onTrackerCreated, std::vector< std::function< void(const ServiceTrackerInfo &)>> onTrackerDestroyed)
 Creates a new meta 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 MetaTracker track service trackers.

Exceptions
celix::Exception
Note
Thread safe.

Member Function Documentation

◆ create()

static std::shared_ptr<MetaTracker> celix::MetaTracker::create ( std::shared_ptr< celix_bundle_context_t >  cCtx,
std::string  serviceName,
std::vector< std::function< void(const ServiceTrackerInfo &)>>  onTrackerCreated,
std::vector< std::function< void(const ServiceTrackerInfo &)>>  onTrackerDestroyed 
)
inlinestatic

Creates a new meta tracker and opens the tracker.

Parameters
cCtxThe c bundle context.
serviceNameThe service name used in the service tracker to track for.
onTrackerCreatedThe callback which will be called when the tracker is created.
onTrackerDestroyedThe callback which will be called when the tracker is destroyed.
Returns
The new meta tracker as shared ptr.
Exceptions
celix::Exception.

◆ open()

void celix::MetaTracker::open ( )
inlineoverridevirtual

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