1
0

api__wac_downloadManager.h 1008 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef NULLSOFT_WAC_DOWNLOAD_MANAGER_API_H
  2. #define NULLSOFT_WAC_DOWNLOAD_MANAGER_API_H
  3. #include "api/service/api_service.h"
  4. #include "api/application/api_application.h"
  5. #define WASABI_API_APP applicationApi
  6. #include "../Agave/Config/api_config.h"
  7. #include "../nu/threadpool/api_threadpool.h"
  8. extern api_threadpool *threadPoolApi;
  9. #define WASABI_API_THREADPOOL threadPoolApi
  10. template <class api_T>
  11. static void ServiceBuild( api_T *&api_t, GUID factoryGUID_t )
  12. {
  13. if ( WASABI_API_SVC )
  14. {
  15. waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid( factoryGUID_t );
  16. if ( factory )
  17. api_t = reinterpret_cast<api_T *>( factory->getInterface() );
  18. }
  19. }
  20. template <class api_T>
  21. static void ServiceRelease( api_T *api_t, GUID factoryGUID_t )
  22. {
  23. if ( WASABI_API_SVC && api_t )
  24. {
  25. waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid( factoryGUID_t );
  26. if ( factory )
  27. factory->releaseInterface( api_t );
  28. }
  29. api_t = NULL;
  30. }
  31. #endif // !NULLSOFT_WAC_DOWNLOAD_MANAGER_API_H