ResourceReaderFactory.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #include "api__filereader.h"
  2. #include "ResourceReaderFactory.h"
  3. #include "ResourceReader.h"
  4. static const char serviceName[] = "Resource reader";
  5. // {C975969A-5DFD-4f2b-B767-4EDC6C7D6484}
  6. static const GUID ResourceReaderGUID =
  7. { 0xc975969a, 0x5dfd, 0x4f2b, { 0xb7, 0x67, 0x4e, 0xdc, 0x6c, 0x7d, 0x64, 0x84 } };
  8. FOURCC ResourceReaderFactory::GetServiceType()
  9. {
  10. return WaSvc::FILEREADER;
  11. }
  12. const char *ResourceReaderFactory::GetServiceName()
  13. {
  14. return serviceName;
  15. }
  16. GUID ResourceReaderFactory::GetGUID()
  17. {
  18. return ResourceReaderGUID;
  19. }
  20. void *ResourceReaderFactory::GetInterface( int global_lock )
  21. {
  22. ResourceReader *ifc = new ResourceReader;
  23. if ( global_lock )
  24. WASABI_API_SVC->service_lock( this, (void *)ifc );
  25. return ifc;
  26. }
  27. int ResourceReaderFactory::SupportNonLockingInterface()
  28. {
  29. return 1;
  30. }
  31. int ResourceReaderFactory::ReleaseInterface(void *ifc)
  32. {
  33. //WASABI_API_SVC->service_unlock(ifc);
  34. svc_fileReader *reader = static_cast<svc_fileReader *>(ifc);
  35. ResourceReader *resourceReader = static_cast<ResourceReader *>(reader);
  36. delete resourceReader;
  37. return 1;
  38. }
  39. const char *ResourceReaderFactory::GetTestString()
  40. {
  41. return 0;
  42. }
  43. int ResourceReaderFactory::ServiceNotify(int msg, int param1, int param2)
  44. {
  45. return 1;
  46. }
  47. #ifdef CBCLASS
  48. #undef CBCLASS
  49. #endif
  50. #define CBCLASS ResourceReaderFactory
  51. START_DISPATCH;
  52. CB(WASERVICEFACTORY_GETSERVICETYPE, GetServiceType)
  53. CB(WASERVICEFACTORY_GETSERVICENAME, GetServiceName)
  54. CB(WASERVICEFACTORY_GETGUID, GetGUID)
  55. CB(WASERVICEFACTORY_GETINTERFACE, GetInterface)
  56. CB(WASERVICEFACTORY_SUPPORTNONLOCKINGGETINTERFACE, SupportNonLockingInterface)
  57. CB(WASERVICEFACTORY_RELEASEINTERFACE, ReleaseInterface)
  58. CB(WASERVICEFACTORY_GETTESTSTRING, GetTestString)
  59. CB(WASERVICEFACTORY_SERVICENOTIFY, ServiceNotify)
  60. END_DISPATCH;