winamp/Src/Components/wac_downloadManager/api__wac_downloadManager.h

40 lines
1008 B
C
Raw Permalink Normal View History

2024-09-24 12:54:57 +00:00
#ifndef NULLSOFT_WAC_DOWNLOAD_MANAGER_API_H
#define NULLSOFT_WAC_DOWNLOAD_MANAGER_API_H
#include "api/service/api_service.h"
#include "api/application/api_application.h"
#define WASABI_API_APP applicationApi
#include "../Agave/Config/api_config.h"
#include "../nu/threadpool/api_threadpool.h"
extern api_threadpool *threadPoolApi;
#define WASABI_API_THREADPOOL threadPoolApi
template <class api_T>
static void ServiceBuild( api_T *&api_t, GUID factoryGUID_t )
{
if ( WASABI_API_SVC )
{
waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid( factoryGUID_t );
if ( factory )
api_t = reinterpret_cast<api_T *>( factory->getInterface() );
}
}
template <class api_T>
static void ServiceRelease( api_T *api_t, GUID factoryGUID_t )
{
if ( WASABI_API_SVC && api_t )
{
waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid( factoryGUID_t );
if ( factory )
factory->releaseInterface( api_t );
}
api_t = NULL;
}
#endif // !NULLSOFT_WAC_DOWNLOAD_MANAGER_API_H