FactoryHelper.h 601 B

12345678910111213141516171819202122232425
  1. #include "api__in_mp3.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 (mod.service)
  7. {
  8. waServiceFactory *factory = mod.service->service_getServiceByGuid(factoryGUID_t);
  9. if (factory)
  10. api_t = reinterpret_cast<api_T *>( factory->getInterface() );
  11. }
  12. }
  13. template <class api_T>
  14. void ServiceRelease(api_T *api_t, GUID factoryGUID_t)
  15. {
  16. if (mod.service && api_t)
  17. {
  18. waServiceFactory *factory = mod.service->service_getServiceByGuid(factoryGUID_t);
  19. if (factory)
  20. factory->releaseInterface(api_t);
  21. }
  22. api_t = NULL;
  23. }