1
0

ServiceBuild.h 736 B

12345678910111213141516171819202122232425262728
  1. #ifndef NULLSOFT_WAC_NETWORK_SERVICEBUILD_H
  2. #define NULLSOFT_WAC_NETWORK_SERVICEBUILD_H
  3. template <class api_T>
  4. static void ServiceBuild( api_T *&p_api_t, GUID p_factoryGUID_t )
  5. {
  6. if ( WASABI_API_SVC )
  7. {
  8. waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid( p_factoryGUID_t );
  9. if ( factory )
  10. p_api_t = reinterpret_cast<api_T *>( factory->getInterface() );
  11. }
  12. }
  13. template <class api_T>
  14. static void ServiceRelease( api_T *p_api_t, GUID p_factoryGUID_t )
  15. {
  16. if ( WASABI_API_SVC && p_api_t )
  17. {
  18. waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid( p_factoryGUID_t );
  19. if ( factory )
  20. factory->releaseInterface( p_api_t );
  21. }
  22. p_api_t = NULL;
  23. }
  24. #endif // !NULLSOFT_WAC_NETWORK_SERVICEBUILD_H