33 #ifndef CXSERVICETRACKERCUSTOMIZER_H_
34 #define CXSERVICETRACKERCUSTOMIZER_H_
36 #include <boost/function.hpp>
38 #include "ctkServiceTracker.h"
39 #include "ctkServiceTrackerCustomizer.h"
62 T* service = reference.getPlugin()->getPluginContext()->getService<T>(reference);
63 if(mServiceAddedFunction)
64 mServiceAddedFunction(service);
69 if(mServiceModifiedFunction)
70 mServiceModifiedFunction(service);
73 virtual void removedService(
const ctkServiceReference &reference, T* service)
75 if(mServiceRemovedFunction)
76 mServiceRemovedFunction(service);
77 reference.getPlugin()->getPluginContext()->ungetService(reference);
82 mServiceAddedFunction = func;
86 mServiceModifiedFunction = func;
90 mServiceRemovedFunction = func;
94 boost::function<void (T*)> mServiceAddedFunction;
95 boost::function<void (T*)> mServiceModifiedFunction;
96 boost::function<void (T*)> mServiceRemovedFunction;
void setServiceAddedCallback(boost::function< void(T *)> func)
void setServiceModifiedCallback(boost::function< void(T *)> func)
void setServiceRemovedCallback(boost::function< void(T *)> func)
Notify changes in a service lifecycle.
ServiceTrackerCustomizer()
virtual ~ServiceTrackerCustomizer()
virtual T * addingService(const ctkServiceReference &reference)
virtual void modifiedService(const ctkServiceReference &reference, T *service)
virtual void removedService(const ctkServiceReference &reference, T *service)