api__wac_browser.h 792 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef NULLSOFT_COMPONENT_WAC_BROWSER_H
  2. #define NULLSOFT_COMPONENT_WAC_BROWSER_H
  3. #include "api/service/api_service.h"
  4. #include "../Agave/Config/api_config.h"
  5. template <class api_T>
  6. void ServiceBuild( api_T *&p_api_t, GUID p_factoryGUID_t )
  7. {
  8. if ( WASABI_API_SVC )
  9. {
  10. waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid( p_factoryGUID_t );
  11. if ( factory )
  12. p_api_t = reinterpret_cast<api_T *>( factory->getInterface() );
  13. }
  14. }
  15. template <class api_T>
  16. void ServiceRelease( api_T *p_api_t, GUID p_factoryGUID_t )
  17. {
  18. if ( WASABI_API_SVC && p_api_t )
  19. {
  20. waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid( p_factoryGUID_t );
  21. if ( factory )
  22. factory->releaseInterface( p_api_t );
  23. }
  24. p_api_t = NULL;
  25. }
  26. #endif // !NULLSOFT_COMPONENT_WAC_BROWSER_H