RealSensePluginImpl.cpp
Go to the documentation of this file.
1 #include "RealSensePluginImpl.h"
2 #include "PCH.h"
3 
4 #if defined(PROF_ENABLED)
5 #include "AllowWindowsPlatformTypes.h"
6 #include <windows.h>
7 #include "HideWindowsPlatformTypes.h"
8 #include "Profiler.inl"
9 #endif
10 
11 DEFINE_LOG_CATEGORY(LogRealSense);
12 
14 {
15  REALSENSE_TRACE(TEXT("+FRealSensePlugin_%p"), this);
16 }
17 
19 {
20  REALSENSE_TRACE(TEXT("~FRealSensePlugin_%p"), this);
21 
23 }
24 
26 {
27  REALSENSE_TRACE(TEXT("FRealSensePlugin_%p::StartupModule"), this);
28 
30 
31  #if WITH_EDITOR
32  FRealSenseDetailCustomization::Register();
33  #endif
34 }
35 
37 {
38  REALSENSE_TRACE(TEXT("FRealSensePlugin_%p::ShutdownModule"), this);
39 
41 
42  #if WITH_EDITOR
43  FRealSenseDetailCustomization::Unregister();
44  #endif
45 
47 }
48 
50 {
51  FScopeLock Lock(&UniqIdMx);
52  return UniqId++;
53 }
54 
56 {
57  if (!Context)
58  {
59  FScopeLock Lock(&ContextMx);
60  if (!Context)
61  {
62  //FPlatformMisc::SetEnvironmentVar(TEXT("OMP_NUM_THREADS"), TEXT("1"));
63 
65  REALSENSE_TRACE(TEXT("rs2_create_context"));
67  if (!e.success())
68  {
69  REALSENSE_ERR(TEXT("rs2_create_context failed: "), *uestr(e.get_message()));
70  return nullptr;
71  }
72 
73  Context = NewNamedObject<URealSenseContext>(nullptr, TEXT("RealSenseContext"));
74  Context->AddToRoot();
77  }
78  }
79 
80  return Context;
81 }
82 
84 {
85  FScopeLock Lock(&ContextMx);
86 
87  if (RsContext)
88  {
89  REALSENSE_TRACE(TEXT("rs2_delete_context %X"), RsContext);
91  RsContext = nullptr;
92  }
93 
94  Context = nullptr;
95 }
96 
97 IMPLEMENT_MODULE(FRealSensePlugin, RealSense)
const char * get_message() const
#define RS2_API_VERSION
Definition: rs.h:41
rs2_context * rs2_create_context(int api_version, rs2_error **error)
Creates RealSense context that is required for the rest of the API.
Definition: rs.cpp:163
FCriticalSection UniqIdMx
virtual void ShutdownModule() override
void rs2_delete_context(rs2_context *context)
Frees the relevant context object.
Definition: rs.cpp:171
#define REALSENSE_ERR(Format,...)
Definition: Shared.h:16
e
Definition: rmse.py:177
#define SHUT_PROFILER
Definition: Rs2Base.h:30
bool success() const
FCriticalSection ContextMx
virtual int GenId() override
virtual class URealSenseContext * GetContext() override
#define INIT_PROFILER
Definition: Rs2Base.h:29
struct rs2_context * RsContext
DEFINE_LOG_CATEGORY(LogRealSense)
void SetHandle(struct rs2_context *Handle)
#define REALSENSE_TRACE(Format,...)
Definition: Shared.h:21
class URealSenseContext * Context
FString uestr(const char *str)
Definition: Shared.h:38
virtual void StartupModule() override


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:39