aboutsummaryrefslogtreecommitdiff
path: root/Src/Components/wac_network/ServiceBuild.h
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Components/wac_network/ServiceBuild.h
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/Components/wac_network/ServiceBuild.h')
-rw-r--r--Src/Components/wac_network/ServiceBuild.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/Src/Components/wac_network/ServiceBuild.h b/Src/Components/wac_network/ServiceBuild.h
new file mode 100644
index 00000000..6b12c5c1
--- /dev/null
+++ b/Src/Components/wac_network/ServiceBuild.h
@@ -0,0 +1,28 @@
+#ifndef NULLSOFT_WAC_NETWORK_SERVICEBUILD_H
+#define NULLSOFT_WAC_NETWORK_SERVICEBUILD_H
+
+template <class api_T>
+static void ServiceBuild( api_T *&p_api_t, GUID p_factoryGUID_t )
+{
+ if ( WASABI_API_SVC )
+ {
+ waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid( p_factoryGUID_t );
+ if ( factory )
+ p_api_t = reinterpret_cast<api_T *>( factory->getInterface() );
+ }
+}
+
+template <class api_T>
+static void ServiceRelease( api_T *p_api_t, GUID p_factoryGUID_t )
+{
+ if ( WASABI_API_SVC && p_api_t )
+ {
+ waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid( p_factoryGUID_t );
+ if ( factory )
+ factory->releaseInterface( p_api_t );
+ }
+
+ p_api_t = NULL;
+}
+
+#endif // !NULLSOFT_WAC_NETWORK_SERVICEBUILD_H