23 #ifndef USSERVICETRACKER_H
24 #define USSERVICETRACKER_H
59 template<
class T,
class TTT>
67 throw std::runtime_error(
"A custom ServiceTrackerCustomizer instance is required for custom tracked objects.");
74 throw std::runtime_error(
"A custom ServiceTrackerCustomizer instance is required for custom tracked objects.");
80 template<
class S,
class T>
81 struct TrackedTypeTraits;
95 template<
class S,
class T>
118 struct TrackedTypeTraits<S,S*>
120 typedef S* TrackedType;
122 static bool IsValid(
const TrackedType& t)
127 static TrackedType DefaultValue()
132 static void Dispose(TrackedType& t)
137 static TrackedType ConvertToTrackedType(S* s)
152 struct TrackedTypeTraits<void,void*>
156 static bool IsValid(
const TrackedType& t)
161 static TrackedType DefaultValue()
163 return TrackedType();
166 static void Dispose(TrackedType& t)
171 static TrackedType ConvertToTrackedType(
const InterfaceMap& im)
230 template<
class S,
class TTT = TrackedTypeTraits<S,S*> >
238 typedef typename TTT::TrackedType
T;
595 #include "usServiceTracker.tpp"
virtual void GetTracked(TrackingMap &tracked) const
~ServiceTracker() override
virtual T GetService(const ServiceReferenceType &reference) const
ServiceTracker(ModuleContext *context, const ServiceReferenceType &reference, ServiceTrackerCustomizer< S, T > *customizer=nullptr)
virtual T GetService() const
virtual void Remove(const ServiceReferenceType &reference)
TTT::TrackedType T
The type of the tracked object.
ServiceTracker(ModuleContext *context, ServiceTrackerCustomizer< S, T > *customizer=nullptr)
virtual ServiceReferenceType GetServiceReference() const
ServiceReference< S > ServiceReferenceType
T AddingService(const ServiceReferenceType &reference) override
ServiceTracker(ModuleContext *context, const LDAPFilter &filter, ServiceTrackerCustomizer< S, T > *customizer=nullptr)
void RemovedService(const ServiceReferenceType &reference, T service) override
virtual bool IsEmpty() const
virtual int GetTrackingCount() const
S ServiceType
The type of the service being tracked.
std::map< ServiceReference< S >, T > TrackingMap
ServiceTracker(ModuleContext *context, const std::string &clazz, ServiceTrackerCustomizer< S, T > *customizer=0)
virtual std::vector< ServiceReferenceType > GetServiceReferences() const
void ModifiedService(const ServiceReferenceType &reference, T service) override
virtual T WaitForService(unsigned long timeoutMillis=0)
virtual std::vector< T > GetServices() const
std::map< std::string, void * > InterfaceMap
static TrackedType ConvertToTrackedType(void *)
static TrackedType ConvertToTrackedType(const InterfaceMap &)
static TrackedType DefaultValue()
static bool IsValid(const TrackedType &t)
static void Dispose(TrackedType &t)
#define US_BEGIN_NAMESPACE