1
0

svcenumt.h 851 B

123456789101112131415161718192021222324252627282930
  1. #ifndef _SVCENUMT_H
  2. #define _SVCENUMT_H
  3. #include "svcenum.h"
  4. template <class T>
  5. class SvcEnumT : private SvcEnum {
  6. protected:
  7. SvcEnumT() { type = T::getServiceType(); }
  8. public:
  9. void reset() { SvcEnum::reset(); }
  10. T *getFirst(int global_lock = TRUE) { reset(); return getNext(global_lock); }
  11. T *getNext(int global_lock = TRUE) { return static_cast<T*>(_getNext(global_lock)); }
  12. // these would just be 'using' but msvc.net sucks butt
  13. inline int release(void *ptr) { return SvcEnum::release(ptr); }
  14. inline waServiceFactory *getLastFactory() { return SvcEnum::getLastFactory(); }
  15. protected:
  16. // override this one (or don't if you want to return all of them)
  17. virtual int testService(T *svc) { return TRUE; }
  18. private:
  19. virtual int _testService(void *svc) {
  20. return testService(static_cast<T *>(svc));
  21. }
  22. };
  23. #endif // _SVCENUMT_H