1
0

svcenum.cpp 930 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include <precomp.h>
  2. //<?#include "<class data="implementationheader"/>"
  3. #include "svcenum.h"
  4. //?>
  5. #include <api/service/services.h>
  6. #include <api/service/waservicefactory.h>
  7. #include <bfc/bfc_assert.h>
  8. SvcEnum::SvcEnum() : type(WaSvc::NONE), factory(NULL) {
  9. reset();
  10. }
  11. void *SvcEnum::_getNext(int global_lock) {
  12. if (WASABI_API_SVC == NULL) return NULL;
  13. for (;;) {
  14. factory = WASABI_API_SVC->service_enumService(type, pos++);
  15. if (factory == NULL) return NULL;
  16. void *s = factory->getInterface(FALSE);// get but don't lock
  17. if (s)
  18. {
  19. if (_testService(s)) {
  20. if (global_lock)
  21. WASABI_API_SVC->service_lock(factory, s); // lock in sys tables
  22. return s;
  23. }
  24. factory->releaseInterface(s);
  25. }
  26. }
  27. }
  28. void SvcEnum::reset() {
  29. pos = 0;
  30. factory = NULL;
  31. }
  32. int SvcEnum::release(void *ptr) {
  33. return WASABI_API_SVC->service_release(ptr);
  34. }
  35. waServiceFactory *SvcEnum::getLastFactory() {
  36. return factory;
  37. }