DaoAI World C# SDK INDUSTRIAL 2024.8.0
Loading...
Searching...
No Matches
managed_object.h
Go to the documentation of this file.
1#pragma once
2
3using namespace System;
4using namespace System::Runtime::InteropServices;
5
6namespace DaoAI
7{
8 namespace DeepLearningCLI
9 {
10 static const char* string_to_char_array(String^ string)
11 {
12 const char* str = (const char*)(Marshal::StringToHGlobalAnsi(string)).ToPointer();
13 return str;
14 }
15
16 template<class T>
17 public ref class ManagedObject
18 {
19 protected:
21 public:
22 ManagedObject(T* instance)
23 : m_Instance(instance)
24 {
25 }
27 : m_Instance(nullptr)
28 {
29 }
31 {
32 if (m_Instance != nullptr)
33 {
34 delete m_Instance;
35 }
36 }
38 {
39 if (m_Instance != nullptr)
40 {
41 delete m_Instance;
42 }
43 }
45 {
46 return m_Instance;
47 }
48 };
49 }
50}
Definition managed_object.h:18
ManagedObject(T *instance)
Definition managed_object.h:22
T * m_Instance
Definition managed_object.h:20
ManagedObject()
Definition managed_object.h:26
T * GetInstance()
Definition managed_object.h:44
virtual ~ManagedObject()
Definition managed_object.h:30
Definition common.cpp:6