api_servicei.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #ifndef __SERVICE_APII_IMPL_H
  2. #define __SERVICE_APII_IMPL_H
  3. /*<?<autoheader/>*/
  4. #include "api_service.h"
  5. #include "api_servicex.h"
  6. class waServiceFactory;
  7. /*?>*/
  8. class api_serviceI : public api_serviceX {
  9. public:
  10. NODISPATCH api_serviceI();
  11. NODISPATCH virtual ~api_serviceI();
  12. // services
  13. /**
  14. Register a service. Service registration is done
  15. on creation of the WAC.
  16. @see WAComponentClient
  17. @ret 1, success; 0, failure.
  18. @param p Pointer to your service factory.
  19. */
  20. DISPATCH(10) int service_register(waServiceFactory *svc);
  21. /**
  22. Deregister a service. Service deregistration is done
  23. on destruction of the WAC.
  24. @see WAComponentClient
  25. @ret 1, success; 0, failure.
  26. @param p Pointer to your service factory.
  27. */
  28. DISPATCH(20) int service_deregister(waServiceFactory *svc);
  29. /**
  30. Get the number of services registered for a specific
  31. service type. This should only be called after
  32. Wasabi is fully started (after WAC creation).
  33. @see FOURCC
  34. @ret Number of services present in that service type.
  35. @param svc_type Service type.
  36. */
  37. DISPATCH(30) int service_getNumServices(FOURCC svc_type); // see common/svc_enum.h
  38. // enumerate by family
  39. /**
  40. Enumerate services by family. This should only
  41. be called after Wasabi is fully started (after WAC creation).
  42. @see FOURCC
  43. @ret Requested service.
  44. @param svc_type Service type.
  45. @param n Number of the service.
  46. */
  47. DISPATCH(40) waServiceFactory *service_enumService(FOURCC svc_type, int n);
  48. // fetch by GUID
  49. /**
  50. Get a service by it's GUID. This should only
  51. be called after Wasabi is fully started (after WAC creation).
  52. @ret Requested service.
  53. @param guid Service GUID.
  54. */
  55. DISPATCH(50) waServiceFactory *service_getServiceByGuid(GUID guid);
  56. // service owner calls this when it issues a service *
  57. /**
  58. Lock a service. Service owner must call this when
  59. it issues a new service pointer to a client.
  60. @ret 1, success; 0, failure;
  61. @param owner Service owner.
  62. @param svcptr Service pointer returned to client.
  63. */
  64. DISPATCH(60) int service_lock(waServiceFactory *owner, void *svcptr);
  65. // service client calls this when it uses a service *
  66. /**
  67. ClientLock a service. Service client must call
  68. this before using the service.
  69. @ret 1, success; 0, failure;
  70. @param svcptr Service pointer.
  71. */
  72. DISPATCH(70) int service_clientLock(void *svcptr);
  73. // service client calls this when done w/ service *
  74. /**
  75. Release a service. Service client must call this
  76. when he's finished using the service. If the service
  77. is NOT released it will cause improper shutdown of
  78. the service.
  79. @ret 1, success; 0, failure;
  80. */
  81. DISPATCH(80) int service_release(void *svcptr);
  82. /**
  83. Get the pretty printed type name of a service type based
  84. on it's FOURCC.
  85. @see FOURCC
  86. @ret Service name (readable).
  87. @param svc_type Service type.
  88. */
  89. DISPATCH(90) const char *service_getTypeName(FOURCC svc_type);
  90. #ifdef WASABI_COMPILE_COMPONENTS
  91. /*[interface.service_getOwningComponent.cpp]#ifdef WASABI_COMPILE_COMPONENTS*/
  92. /*[interface.service_getOwningComponent.h]#ifdef WASABI_COMPILE_COMPONENTS*/
  93. /*[dispatchable.service_getOwningComponent.enum]#ifdef WASABI_COMPILE_COMPONENTS*/
  94. /*[dispatchable.service_getOwningComponent.bridge]#ifdef WASABI_COMPILE_COMPONENTS*/
  95. /**
  96. Get the owning component of a service from
  97. a service pointer.
  98. @ret GUID of the owning component.
  99. @param svcptr Service pointer.
  100. */
  101. DISPATCH(100) GUID service_getOwningComponent(void *svcptr);
  102. /**
  103. Get the locking component for a service from
  104. a service pointer.
  105. @ret GUID of the locking component.
  106. @param svcptr Service pointer.
  107. */
  108. DISPATCH(110) GUID service_getLockingComponent(void *svcptr);
  109. /*[interface.service_unlock.cpp]#endif // WASABI_COMPILE_COMPONENTS*/
  110. /*[interface.service_unlock.h]#endif // WASABI_COMPILE_COMPONENTS*/
  111. /*[dispatchable.service_unlock.enum]#endif // WASABI_COMPILE_COMPONENTS*/
  112. /*[dispatchable.service_unlock.bridge]#endif // WASABI_COMPILE_COMPONENTS*/
  113. #endif
  114. DISPATCH(120) int service_unlock(void *svcptr);
  115. DISPATCH(130) int service_isvalid(FOURCC svctype, waServiceFactory *service);
  116. };
  117. /*[interface.footer.h]
  118. extern api_service *serviceApi;
  119. */
  120. #endif // __SERVICE_APII_IMPL_H