1
0

waservicefactoryi.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef __WASERVICEFACTORY_IMPL_H
  2. #define __WASERVICEFACTORY_IMPL_H
  3. /*<?<autoheader/>*/
  4. #include "waservicefactory.h"
  5. #include "waservicefactoryx.h"
  6. class CfgItem;
  7. /*?>*/
  8. /*[interface.header.h]
  9. #include "common/nsguid.h"
  10. #include "studio/api.h"
  11. */
  12. // this is a wasabi service factory. it's a static object you can query to
  13. // fetch the * to your real service interface
  14. class NOVTABLE waServiceFactoryI : public waServiceFactoryX {
  15. public:
  16. virtual ~waServiceFactoryI() {}
  17. protected:
  18. /*[interface.x_getServiceType.h]
  19. public:
  20. */
  21. DISPATCH(100) virtual FOURCC x_getServiceType() { return svc_serviceType(); } // see services.h
  22. DISPATCH(200) virtual const char *x_getServiceName() { return svc_getServiceName(); }
  23. DISPATCH(210) virtual GUID getGuid() { return svc_getGuid(); } // GUID per service factory, can be INVALID_GUID
  24. /**
  25. Fetches a pointer to an instance of the service. Optionally locks it into the
  26. global table, so that it can be safely released via service_release()
  27. @see ComponentAPI::service_release()
  28. @param global_lock If TRUE, calls service_lock() with the service *
  29. @see releaseInterface()
  30. */
  31. /*[dispatchable.getInterface.postcall]
  32. // -- generated code - edit in waservicefactoryi.h
  33. // support old code that always locks even when global_lock==FALSE
  34. if (!global_lock && __retval != NULL && !supportNonLockingGetInterface())
  35. WASABI_API_SVC->service_unlock(__retval);
  36. */
  37. DISPATCH(300) virtual void *getInterface(int global_lock = TRUE) { return svc_getInterface(global_lock); }
  38. DISPATCH(300) virtual void *_RETIRED_getInterface() { return getInterface(); } // for back compat
  39. DISPATCH(301) virtual int supportNonLockingGetInterface() { return svc_supportNonLockingGetInterface(); }
  40. /**
  41. Releases a pointer to an instance of the service. Call this when you're done
  42. with a service interface. Do NOT just call delete on it! Only the original
  43. service factory can safely delete it. Also, do not pass in any pointers
  44. that were not allocated from this factory.
  45. @see getInterface()
  46. @ret TRUE if no error, FALSE if error.
  47. */
  48. DISPATCH(310) virtual int releaseInterface(void *ifc) { return svc_releaseInterface(ifc); } // when they're done w/ it
  49. /**
  50. Fetches a string for optional quick lookup of a service factory. This string
  51. is defined on a service family type basis. e.g. the xuitag for xuicreators.
  52. */
  53. DISPATCH(500) virtual const wchar_t *getTestString() { return svc_getTestString(); }
  54. DISPATCH(600) virtual int serviceNotify(int msg, int param1 = 0, int param2 = 0) { return svc_notify(msg, param1, param2); }
  55. public:
  56. NODISPATCH virtual FOURCC svc_serviceType()=0; // see services.h
  57. NODISPATCH virtual const char *svc_getServiceName()=0;
  58. NODISPATCH virtual GUID svc_getGuid()=0; // GUID per service factory, can be INVALID_GUID
  59. NODISPATCH virtual void *svc_getInterface(int global_lock = TRUE)=0;
  60. NODISPATCH virtual int svc_supportNonLockingGetInterface() { return TRUE; }
  61. NODISPATCH virtual int svc_releaseInterface(void *ifc)=0; // when they're done w/ it
  62. NODISPATCH virtual CfgItem *svc_getCfgInterface()=0;
  63. NODISPATCH virtual const wchar_t *svc_getTestString()=0;
  64. NODISPATCH virtual int svc_notify(int msg, int param1 = 0, int param2 = 0)=0;
  65. };
  66. #endif // __WASERVICEFACTORY_IMPL_H