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.2 KiB51 linesraw
1#pragma once
2#include "RefCounter.hpp"
3#include "../comLightCommon.h"
4#include "../utils/typeTraits.hpp"
5
6namespace ComLight
7{
8	// Base class of objects, implements reference counting, also a few lifetime methods.
9	// The template argument is the interface you want clients to get when they ask for IID_IUnknown. By convention, that pointer defines object's identity.
10	template<class I>
11	class ObjectRoot : public RefCounter, public I
12	{
13	protected:
14
15		inline HRESULT internalFinalConstruct()
16		{
17			return S_FALSE;
18		}
19
20		inline HRESULT FinalConstruct()
21		{
22			return S_FALSE;
23		}
24
25		inline void FinalRelease() { }
26
27		IUnknown* getUnknown()
28		{
29			static_assert( details::pointersAssignable<IUnknown, I>(), "The interface doesn't derive from IUnknown" );
30			return static_cast<I*>( this );
31		}
32
33		bool queryExtraInterfaces( REFIID riid, void **ppvObject ) const
34		{
35			return false;
36		}
37
38		// Implement query interface with 2 entries, IUnknown and I.
39		bool implQueryInterface( REFIID riid, void** ppvObject )
40		{
41			if( riid == I::iid() || riid == IUnknown::iid() )
42			{
43				I* const result = this;
44				result->AddRef();
45				*ppvObject = result;
46				return true;
47			}
48			return false;
49		}
50	};
51}