Factory.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #include "Factory.h"
  2. #include "api.h"
  3. #include "timerapi.h"
  4. TimerApi *timer_svc = 0;
  5. static const char serviceName[] = "Timer Service";
  6. void Factory::Stop()
  7. {
  8. delete timer_svc;
  9. timer_svc=0;
  10. }
  11. FOURCC Factory::GetServiceType()
  12. {
  13. return WaSvc::UNIQUE;
  14. }
  15. const char *Factory::GetServiceName()
  16. {
  17. return serviceName;
  18. }
  19. GUID Factory::GetGUID()
  20. {
  21. return timerApiServiceGuid;
  22. }
  23. void *Factory::GetInterface(int global_lock)
  24. {
  25. if (!timer_svc)
  26. timer_svc = new TimerApi;
  27. // if (global_lock)
  28. // WASABI_API_SVC->service_lock(this, (void *)ifc);
  29. return timer_svc;
  30. }
  31. int Factory::SupportNonLockingInterface()
  32. {
  33. return 1;
  34. }
  35. int Factory::ReleaseInterface(void *ifc)
  36. {
  37. //WASABI_API_SVC->service_unlock(ifc);
  38. return 1;
  39. }
  40. const char *Factory::GetTestString()
  41. {
  42. return 0;
  43. }
  44. int Factory::ServiceNotify(int msg, int param1, int param2)
  45. {
  46. return 1;
  47. }
  48. #define CBCLASS Factory
  49. START_DISPATCH;
  50. CB(WASERVICEFACTORY_GETSERVICETYPE, GetServiceType)
  51. CB(WASERVICEFACTORY_GETSERVICENAME, GetServiceName)
  52. CB(WASERVICEFACTORY_GETGUID, GetGUID)
  53. CB(WASERVICEFACTORY_GETINTERFACE, GetInterface)
  54. CB(WASERVICEFACTORY_SUPPORTNONLOCKINGGETINTERFACE, SupportNonLockingInterface)
  55. CB(WASERVICEFACTORY_RELEASEINTERFACE, ReleaseInterface)
  56. CB(WASERVICEFACTORY_GETTESTSTRING, GetTestString)
  57. CB(WASERVICEFACTORY_SERVICENOTIFY, ServiceNotify)
  58. END_DISPATCH;
  59. #undef CBCLASS