CTK 0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Loading...
Searching...
No Matches
ctkServiceTracker.h
Go to the documentation of this file.
1/*=============================================================================
2
3 Library: CTK
4
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics
7
8 Licensed under the Apache License, Version 2.0 (the "License");
9 you may not use this file except in compliance with the License.
10 You may obtain a copy of the License at
11
12 http://www.apache.org/licenses/LICENSE-2.0
13
14 Unless required by applicable law or agreed to in writing, software
15 distributed under the License is distributed on an "AS IS" BASIS,
16 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 See the License for the specific language governing permissions and
18 limitations under the License.
19
20=============================================================================*/
21
22
23#ifndef CTKSERVICETRACKER_H
24#define CTKSERVICETRACKER_H
25
26#include <QScopedPointer>
27
28#include "ctkPluginFrameworkExport.h"
29
30#include "ctkServiceReference.h"
32#include "ctkLDAPSearchFilter.h"
33
34template<class S, class T> class ctkTrackedService;
35template<class S, class T> class ctkServiceTrackerPrivate;
37
73template<class S = QObject*, class T = S>
75{
76public:
77
79
101 const ctkServiceReference& reference,
102 ctkServiceTrackerCustomizer<T>* customizer = 0);
103
122 ctkServiceTracker(ctkPluginContext* context, const QString& clazz,
123 ctkServiceTrackerCustomizer<T>* customizer = 0);
124
145 ctkServiceTrackerCustomizer<T>* customizer = 0);
146
165
178 virtual void open();
179
191 virtual void close();
192
212 virtual T waitForService(unsigned long timeout);
213
221
242
253 virtual T getService(const ctkServiceReference& reference) const;
254
268 virtual QList<T> getServices() const;
269
281 virtual T getService() const;
282
293 virtual void remove(const ctkServiceReference& reference);
294
301 virtual int size() const;
302
322 virtual int getTrackingCount() const;
323
336 virtual QMap<ctkServiceReference, T> getTracked() const;
337
344 virtual bool isEmpty() const;
345
346protected:
347
375
391 void modifiedService(const ctkServiceReference& reference, T service);
392
414 void removedService(const ctkServiceReference& reference, T service);
415
416private:
417
418 typedef ctkServiceTracker<S,T> ServiceTracker;
421 typedef ctkServiceTrackerCustomizer<T> ServiceTrackerCustomizer;
422
423 friend class ctkTrackedService<S,T>;
424 friend class ctkServiceTrackerPrivate<S,T>;
425
426 inline ServiceTrackerPrivate* d_func()
427 {
428 return reinterpret_cast<ServiceTrackerPrivate*>(qGetPtrHelper(d_ptr));
429 }
430
431 inline const ServiceTrackerPrivate* d_func() const
432 {
433 return reinterpret_cast<const ServiceTrackerPrivate*>(qGetPtrHelper(d_ptr));
434 }
435
436 const QScopedPointer<ServiceTrackerPrivate> d_ptr;
437};
438
439#include "ctkServiceTracker.tpp"
440
441#endif // CTKSERVICETRACKER_H
virtual T waitForService(unsigned long timeout)
virtual void close()
ctkServiceTracker(ctkPluginContext *context, ctkServiceTrackerCustomizer< T > *customizer=0)
ctkServiceTracker(ctkPluginContext *context, const ctkLDAPSearchFilter &filter, ctkServiceTrackerCustomizer< T > *customizer=0)
virtual QMap< ctkServiceReference, T > getTracked() const
virtual T getService() const
virtual T getService(const ctkServiceReference &reference) const
T addingService(const ctkServiceReference &reference)
virtual void remove(const ctkServiceReference &reference)
virtual ctkServiceReference getServiceReference() const
virtual QList< T > getServices() const
ctkServiceTracker(ctkPluginContext *context, const ctkServiceReference &reference, ctkServiceTrackerCustomizer< T > *customizer=0)
ctkServiceTracker(ctkPluginContext *context, const QString &clazz, ctkServiceTrackerCustomizer< T > *customizer=0)
virtual int size() const
virtual QList< ctkServiceReference > getServiceReferences() const
virtual bool isEmpty() const
void modifiedService(const ctkServiceReference &reference, T service)
void removedService(const ctkServiceReference &reference, T service)
virtual int getTrackingCount() const
virtual void open()