Extended .NET SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
ThreadsCounter.cs
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// <auto-generated />
3//
4// This file was automatically generated by SWIG (http://www.swig.org).
5// Version 4.0.2
6//
7// Do not make changes to this file unless you know what you are doing--modify
8// the SWIG interface file instead.
9//------------------------------------------------------------------------------
10
11namespace Teigha.Core {
12
13using System;
14using System.Runtime.InteropServices;
15
16public class ThreadsCounter : global::System.IDisposable {
17 private Object locker = new Object();
18 private HandleRef swigCPtr;
19 protected bool swigCMemOwn;
20 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
21 public ThreadsCounter(IntPtr cPtr, bool cMemoryOwn) {
22 swigCMemOwn = cMemoryOwn;
23 swigCPtr = new HandleRef(this, cPtr);
24 }
25 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
26 public static HandleRef getCPtr(ThreadsCounter obj) {
27 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
28 }
29
31 Dispose(false);
32 }
33
34 public void Dispose() {
35 Dispose(true);
36 global::System.GC.SuppressFinalize(this);
37 }
38
39 protected virtual void Dispose(bool disposing) {
40 if (swigCPtr.Handle != IntPtr.Zero)
41 {
42 if (swigCMemOwn)
43 {
44 lock (locker)//(this)
45 {
46 if ((swigCPtr.Handle != IntPtr.Zero) && (swigCMemOwn))
47 {
48 swigCMemOwn = false;
49 //throw new MethodAccessException("C++ destructor does not have public access");
50 }
51 }
52 swigCMemOwn = false;
53 }
54 swigCPtr = new HandleRef(null, IntPtr.Zero);
55 }
56 GC.SuppressFinalize(this);
57 }
58
59 public bool addReactor(ThreadsCounterReactor pReactor) {
62 return ret;
63 }
64
65 public bool removeReactor(ThreadsCounterReactor pReactor) {
68 return ret;
69 }
70
71 public bool hasReactor(ThreadsCounterReactor pReactor) {
74 return ret;
75 }
76
77 public int nReactors() {
78 int ret = GlobalsPINVOKE.ThreadsCounter_nReactors(swigCPtr);
80 return ret;
81 }
82
86 }
87
89 OdRxThreadPoolService ret = (OdRxThreadPoolService)Teigha.Core.Helpers.odrxCreateObjectInternalUniversal(typeof(OdRxThreadPoolService),GlobalsPINVOKE.ThreadsCounter_getThreadPoolService(swigCPtr),false); /*createInt 3_2*/
90
92 return ret;
93}
94
95 public void increase(uint nThreads, UInt32[] /*SIMPLE_ARRAY*/ aThreads, uint nThreadAttributes) {
96 GlobalsPINVOKE.ThreadsCounter_increase__SWIG_0(swigCPtr, nThreads, Teigha.Core.Helpers.MarshalUInt32FixedArray(aThreads), nThreadAttributes);
98 }
99
100 public void increase(uint nThreads, UInt32[] /*SIMPLE_ARRAY*/ aThreads) {
101 GlobalsPINVOKE.ThreadsCounter_increase__SWIG_1(swigCPtr, nThreads, Teigha.Core.Helpers.MarshalUInt32FixedArray(aThreads));
103 }
104
105 public void decrease(uint nThreads, UInt32[] /*SIMPLE_ARRAY*/ aThreads) {
106 GlobalsPINVOKE.ThreadsCounter_decrease(swigCPtr, nThreads, Teigha.Core.Helpers.MarshalUInt32FixedArray(aThreads));
108 }
109
110 public void startThread() {
113 }
114
115 public void stopThread() {
118 }
119
120 public bool hasThread(uint nThreadId, UInt32[] /*SIMPLE_ARRAY*/ pThreadAttributes) {
121 bool ret = GlobalsPINVOKE.ThreadsCounter_hasThread(swigCPtr, nThreadId, Teigha.Core.Helpers.MarshalUInt32FixedArray(pThreadAttributes));
123 return ret;
124 }
125
126 public void setMainThreadFunc(Globals.ExecuteMainThreadFuncDelegate /*CS_DELEGATE_CONNECT_TYPEMAP_PART_BASE cstype*/ func) {
127/*CS_DELEGATE_CONNECT_TYPEMAP_PART_VOID_RETURN pre csin start*/
128 Globals.ExecuteMainThreadFuncDelegateNative func_inDelegate = null;
129 if (func != null)
130 {
131 func_inDelegate = (Globals.MainThreadFuncDelegateNative _func,IntPtr _arg) =>
132 {
133 Globals.MainThreadFuncDelegateNative func_nativeTemp = _func;
134 Globals.MainThreadFuncDelegate func_csharpTemp = null;
135 if (func_nativeTemp != null)
136 func_csharpTemp = (IntPtr __arg) => { func_nativeTemp(__arg); };
137
138
139
140
141
142
143
144
145 try
146 {
147 func(func_csharpTemp,_arg);
148 }
149 finally
150 {
151 ;
152 }
153 };
154 }
155 IntPtr func_ptr = (func == null) ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(func_inDelegate);
156 Teigha.Core.DelegateHolder.Add(func_inDelegate);
157 /*CS_DELEGATE_CONNECT_TYPEMAP_PART_VOID_RETURN pre csin end*/
158 try {
159 GlobalsPINVOKE.ThreadsCounter_setMainThreadFunc(swigCPtr, func_ptr /*CS_DELEGATE_CONNECT_TYPEMAP_PART_VOID_RETURN csin*/ );
161 } finally {
162//Empty post /*CS_DELEGATE_CONNECT_TYPEMAP_PART_VOID_RETURN post csin*/
163 }
164 }
165
166 public Globals.ExecuteMainThreadFuncDelegate getMainThreadFunc() {
167 /*CS_DELEGATE_CONNECT_TYPEMAP_PART_VOID_RETURN csout start*/
168 IntPtr nativeCallback = GlobalsPINVOKE.ThreadsCounter_getMainThreadFunc(swigCPtr);
169
171 Globals.ExecuteMainThreadFuncDelegate outDelegate = null;
172 if (nativeCallback != IntPtr.Zero)
173 {
174 outDelegate = (Globals.MainThreadFuncDelegate _func,IntPtr _arg) =>
175 {
176 Globals.ExecuteMainThreadFuncDelegateNative cPtr_NativeDelegate = Marshal.GetDelegateForFunctionPointer(nativeCallback, typeof(Globals.ExecuteMainThreadFuncDelegateNative)) as Globals.ExecuteMainThreadFuncDelegateNative;
177 Globals.MainThreadFuncDelegate func_csharpTemp = _func;
178 Globals.MainThreadFuncDelegateNative func_nativeTemp = null;
179 if (func_csharpTemp != null)
180 func_nativeTemp = (IntPtr __arg) => { func_csharpTemp(__arg); };
181
182
183
184
185
186
187
188
189 cPtr_NativeDelegate(func_nativeTemp,_arg);
190 ;
191 };
192 }
193 return outDelegate;
194 /*CS_DELEGATE_CONNECT_TYPEMAP_PART_VOID_RETURN csout end*/
195 }
196
197 public enum ThreadAttributes : uint {
198 kNoAttributes = 0,
199 kMtLoadingAttributes = (1 << 0),
200 kMtRegenAttributes = (1 << 1),
201 kStRegenAttributes = (1 << 2),
202 kMtDisplayAttributes = (1 << 3),
203 kMtModelerAttributes = (1 << 4),
204 kAllAttributes = 0xFFFFFFFF
205 }
206
207}
208
209}
delegate void ExecuteMainThreadFuncDelegate(Globals.MainThreadFuncDelegate _func, IntPtr _arg)
delegate void MainThreadFuncDelegate(IntPtr arg1)
delegate void MainThreadFuncDelegateNative(IntPtr arg1)
delegate void ExecuteMainThreadFuncDelegateNative(Globals.MainThreadFuncDelegateNative _func, IntPtr _arg)
static global::System.Exception Retrieve()
static IntPtr ThreadsCounter_getMainThreadFunc(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool ThreadsCounter_hasReactor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void ThreadsCounter_setMainThreadFunc(global::System.Runtime.InteropServices.HandleRef jarg1, IntPtr jarg2)
static bool ThreadsCounter_hasThread(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, IntPtr jarg3)
static bool ThreadsCounter_removeReactor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static bool ThreadsCounter_addReactor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void ThreadsCounter_startThread(global::System.Runtime.InteropServices.HandleRef jarg1)
static void ThreadsCounter_decrease(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, IntPtr jarg3)
static void ThreadsCounter_increase__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, IntPtr jarg3)
static void ThreadsCounter_stopThread(global::System.Runtime.InteropServices.HandleRef jarg1)
static void ThreadsCounter_setThreadPoolService(global::System.Runtime.InteropServices.HandleRef jarg1, HandleRef jarg2)
static int ThreadsCounter_nReactors(global::System.Runtime.InteropServices.HandleRef jarg1)
static void ThreadsCounter_increase__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, IntPtr jarg3, uint jarg4)
static IntPtr ThreadsCounter_getThreadPoolService(global::System.Runtime.InteropServices.HandleRef jarg1)
static HandleRef getCPtr(OdRxThreadPoolService obj)
Globals.ExecuteMainThreadFuncDelegate getMainThreadFunc()
void setThreadPoolService(OdRxThreadPoolService pService)
void decrease(uint nThreads, UInt32[] aThreads)
void setMainThreadFunc(Globals.ExecuteMainThreadFuncDelegate func)
OdRxThreadPoolService getThreadPoolService()
bool removeReactor(ThreadsCounterReactor pReactor)
static HandleRef getCPtr(ThreadsCounter obj)
ThreadsCounter(IntPtr cPtr, bool cMemoryOwn)
bool hasReactor(ThreadsCounterReactor pReactor)
void increase(uint nThreads, UInt32[] aThreads, uint nThreadAttributes)
bool hasThread(uint nThreadId, UInt32[] pThreadAttributes)
void increase(uint nThreads, UInt32[] aThreads)
bool addReactor(ThreadsCounterReactor pReactor)
virtual void Dispose(bool disposing)
static HandleRef getCPtr(ThreadsCounterReactor obj)