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.
Public Member Functions | Protected Attributes | List of all members
celix::GenericServiceTracker Class Reference

he GenericServiceTracker class is a specialization of the AbstractTracker for managing a service tracker. More...

#include <Trackers.h>

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

Public Member Functions

 GenericServiceTracker (std::shared_ptr< celix_bundle_context_t > _cCtx, std::string_view _svcName, std::string_view _svcVersionRange, celix::Filter _filter)
 
 ~GenericServiceTracker () override=default
 
void open () override
 
const std::string & getServiceName () const
 The service name tracked by this service tracker. More...
 
const std::string & getServiceRange () const
 The service version range tracked by this service tracker. More...
 
const celix::Filter & getFilter () const
 The additional filter for services tracked by this service tracker. More...
 
std::size_t getServiceCount () const
 The nr of services currently tracked by this tracker. More...
 
- 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...
 

Protected Attributes

const std::string svcName
 
const std::string svcVersionRange
 
const celix::Filter filter
 
celix_service_tracking_options opts {}
 
std::atomic< size_t > svcCount {0}
 
- 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}
 

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 ()
 

Detailed Description

he GenericServiceTracker class is a specialization of the AbstractTracker for managing a service tracker.

It defines how service trackers are opened ands manages some shared service tracker fields.

Note
Thread safe.

Constructor & Destructor Documentation

◆ GenericServiceTracker()

celix::GenericServiceTracker::GenericServiceTracker ( std::shared_ptr< celix_bundle_context_t >  _cCtx,
std::string_view  _svcName,
std::string_view  _svcVersionRange,
celix::Filter  _filter 
)
inline

◆ ~GenericServiceTracker()

celix::GenericServiceTracker::~GenericServiceTracker ( )
overridedefault

Member Function Documentation

◆ getFilter()

const celix::Filter& celix::GenericServiceTracker::getFilter ( ) const
inline

The additional filter for services tracked by this service tracker.

This filter is additional to the service name and optional service version range.

◆ getServiceCount()

std::size_t celix::GenericServiceTracker::getServiceCount ( ) const
inline

The nr of services currently tracked by this tracker.

◆ getServiceName()

const std::string& celix::GenericServiceTracker::getServiceName ( ) const
inline

The service name tracked by this service tracker.

◆ getServiceRange()

const std::string& celix::GenericServiceTracker::getServiceRange ( ) const
inline

The service version range tracked by this service tracker.

◆ open()

void celix::GenericServiceTracker::open ( )
inlineoverridevirtual

Member Data Documentation

◆ filter

const celix::Filter celix::GenericServiceTracker::filter
protected

◆ opts

celix_service_tracking_options celix::GenericServiceTracker::opts {}
protected

◆ svcCount

std::atomic<size_t> celix::GenericServiceTracker::svcCount {0}
protected

◆ svcName

const std::string celix::GenericServiceTracker::svcName
protected

◆ svcVersionRange

const std::string celix::GenericServiceTracker::svcVersionRange
protected

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