NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cx::ServiceTrackerListener< T > Class Template Reference

Helper class for listening to services being added, modified and removed. More...

#include <cxServiceTrackerListener.h>

Public Member Functions

 ServiceTrackerListener (ctkPluginContext *context, boost::function< void(T *)> serviceAdded, boost::function< void(T *)> serviceModified, boost::function< void(T *)> serviceRemoved)
 
 ~ServiceTrackerListener ()
 
void open ()
 
T * getServiceFromName (QString name)
 
QList< T * > getServices ()
 

Detailed Description

template<class T>
class cx::ServiceTrackerListener< T >

Helper class for listening to services being added, modified and removed.

Usage example: For listening to ReconstructionServices being added and removed, but ignoring if they are modified

NB: This class can only be used with a valid plugin context. And plugin contexts are only valid when the plugin framework is in one of these states: ACTIVE, STARTING and STOPPING

boost::shared_ptr<ServiceTrackerListener<ReconstructionService> > mServiceListener; mServiceListener.reset(new ServiceTrackerListener<ReconstructionService>( LogicManager::getInstance()->getPluginFramework(), boost::bind(&ReconstructManager::onServiceAdded, this, _1), boost::bind(&ReconstructManager::onServiceModified, this, _1), boost::bind(&ReconstructManager::onServiceRemoved, this, _1) ));

Date
May 14, 2014
Author
Janne Beate Bakeng, SINTEF

Definition at line 53 of file cxServiceTrackerListener.h.

Constructor & Destructor Documentation

◆ ServiceTrackerListener()

template<class T >
cx::ServiceTrackerListener< T >::ServiceTrackerListener ( ctkPluginContext *  context,
boost::function< void(T *)>  serviceAdded,
boost::function< void(T *)>  serviceModified,
boost::function< void(T *)>  serviceRemoved 
)
inline

Definition at line 57 of file cxServiceTrackerListener.h.

◆ ~ServiceTrackerListener()

template<class T >
cx::ServiceTrackerListener< T >::~ServiceTrackerListener ( )
inline

Definition at line 70 of file cxServiceTrackerListener.h.

Member Function Documentation

◆ getServiceFromName()

template<class T >
T* cx::ServiceTrackerListener< T >::getServiceFromName ( QString  name)
inline

Definition at line 82 of file cxServiceTrackerListener.h.

◆ getServices()

template<class T >
QList<T*> cx::ServiceTrackerListener< T >::getServices ( )
inline

Definition at line 91 of file cxServiceTrackerListener.h.

◆ open()

template<class T >
void cx::ServiceTrackerListener< T >::open ( )
inline

Definition at line 77 of file cxServiceTrackerListener.h.


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