FactoryHelper.h 561 B

123456789101112131415161718192021222324
  1. #include "api.h"
  2. #include <api/service/waservicefactory.h>
  3. template <class api_T>
  4. void ServiceBuild(api_T *&api_t, GUID factoryGUID_t)
  5. {
  6. if (plugin.service)
  7. {
  8. waServiceFactory *factory = plugin.service->service_getServiceByGuid(factoryGUID_t);
  9. if (factory)
  10. api_t = (api_T *)factory->getInterface();
  11. }
  12. }
  13. template <class api_T>
  14. void ServiceRelease(api_T *api_t, GUID factoryGUID_t)
  15. {
  16. if (plugin.service)
  17. {
  18. waServiceFactory *factory = plugin.service->service_getServiceByGuid(factoryGUID_t);
  19. if (factory)
  20. factory->releaseInterface(api_t);
  21. }
  22. }