ImagingTools Core SDK
CGqlRequestContextManager.h
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ImtCore-Commercial
2#pragma once
3
4
5// ImtCore includes
6#include <imtgql/IGqlContext.h>
7
8
9namespace imtgql
10{
11
12
13class CGqlRequestContextManager
14{
15public:
16 static void SetContext(const IGqlContext* contextPtr)
17 {
18 if (contextPtr == nullptr) {
19 s_context.Reset();
20 return;
21 }
22
23 s_context.MoveCastedPtr(contextPtr->CloneMe());
24 }
25
26 static IGqlContext* GetContext()
27 {
28 return s_context.GetPtr();
29 }
30
31 static void Clear()
32 {
33 s_context.Reset();
34 }
35
36private:
37 static thread_local istd::TSharedInterfacePtr<IGqlContext> s_context;
38};
39
40
41} // namespace imtgql
42
43