aboutsummaryrefslogtreecommitdiff
path: root/Src/Components/wac_downloadManager/api__wac_downloadManager.h
blob: 241b148c46737129cd9c31ad9fd89804b490f90b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#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