yum-archive/TaSTT-Whisper

High-performance GPGPU inference of OpenAI's Whisper automatic speech recognition (ASR) model

git clone https://git.yummers.dev/yum-archive/TaSTT-Whisper

KonstantinSource codes8c4603c

master
1.1 KiB31 linesraw
1#pragma once
2#include "../utils/typeTraits.hpp"
3
4// Unlike ATL, the interface map is optional for ComLight.
5// If you won't declare a map, the object will support 2 interfaces: IUnknown, and whatever template argument was passed to ObjectRoot class.
6#define BEGIN_COM_MAP()                                      \
7protected:                                                   \
8bool implQueryInterface( REFIID iid, void** ppvObject ) {
9
10#define END_COM_MAP() return false; }
11
12namespace ComLight
13{
14	namespace details
15	{
16		template<typename I, typename C>
17		inline bool tryReturnInterface( REFIID iid, C* pThis, void** ppvResult )
18		{
19			static_assert( pointersAssignable<IUnknown, I>(), "Trying to implement an interface that doesn't derive from IUnknown" );
20			static_assert( pointersAssignable<I, C>(), "Declared support for an interface, but the class doesn't implement it" );
21			if( I::iid() != iid )
22				return false;
23			I* const result = pThis;
24			result->AddRef();
25			*ppvResult = result;
26			return true;
27		}
28	}
29}
30
31#define COM_INTERFACE_ENTRY( I ) if( ComLight::details::tryReturnInterface<I>( iid, this, ppvObject ) ) return true;