Extended .NET SDK Documentation 2025 SP0
Loading...
Searching...
No Matches
OdDbEntityArray.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.TD {
12
13using System;
14using System.Runtime.InteropServices;
15using Teigha.Core;
16
17public class OdDbEntityArray : IDisposable, System.Collections.IEnumerable
18, System.Collections.Generic.IList<OdDbEntity>
19 {
20 private Object locker = new Object();
21 private HandleRef swigCPtr;
22 protected bool swigCMemOwn;
23 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
24 public OdDbEntityArray(IntPtr cPtr, bool cMemoryOwn) {
25 swigCMemOwn = cMemoryOwn;
26 swigCPtr = new HandleRef(this, cPtr);
27 }
28 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
29 public static HandleRef getCPtr(OdDbEntityArray obj) {
30 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
31 }
32
34 Dispose(false);
35 }
36
37 public void Dispose() {
38 Dispose(true);
39 global::System.GC.SuppressFinalize(this);
40 }
41
42 protected virtual void Dispose(bool disposing) {
43 lock(this) {
44 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
45 if (swigCMemOwn) {
46 swigCMemOwn = false;
48 }
49 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
50 }
51 }
52 }
53
54 public OdDbEntityArray(System.Collections.ICollection c) : this() {
55 if (c == null)
56 throw new ArgumentNullException("c");
57 foreach (OdDbEntity element in c) {
58 this.Add(element);
59 }
60 }
61
62 public OdDbEntityArray(bool bGCMemory_Own = false)
63 : this(TD_DbPINVOKE.new_OdDbEntityArray__SWIG_0(), bGCMemory_Own || MemoryManager.GetMemoryManager().GetCurrentTransaction() == null)
64 {
65 MemoryTransaction mTr = MemoryManager.GetMemoryManager().GetCurrentTransaction(); // MemoryTransaction #9
66 if (!bGCMemory_Own && null != mTr)
67 {
68 mTr.AddObject(new OdDbEntityArray(swigCPtr.Handle, true));
69 }
71 }
72
73 public OdDbEntityArray(OdDbEntityArray other, bool bGCMemory_Own = false) : this(TD_DbPINVOKE.new_OdDbEntityArray__SWIG_1(OdDbEntityArray.getCPtr(other)), bGCMemory_Own || MemoryManager.GetMemoryManager().GetCurrentTransaction() == null) {
74 MemoryTransaction mTr = MemoryManager.GetMemoryManager().GetCurrentTransaction(); // MemoryTransaction #10
75 if (!bGCMemory_Own && null != mTr)
76 {
77 mTr.AddObject(new OdDbEntityArray(swigCPtr.Handle, true));
78 }
80 }
81
82 public OdDbEntityArray(int capacity, bool bGCMemory_Own = false) : this(TD_DbPINVOKE.new_OdDbEntityArray__SWIG_2(capacity), bGCMemory_Own || MemoryManager.GetMemoryManager().GetCurrentTransaction() == null) {
83 MemoryTransaction mTr = MemoryManager.GetMemoryManager().GetCurrentTransaction(); // MemoryTransaction #11
84 if (!bGCMemory_Own && null != mTr)
85 {
86 mTr.AddObject(new OdDbEntityArray(swigCPtr.Handle, true));
87 }
89 }
90
91 public bool IsFixedSize {
92 get {
93 return false;
94 }
95 }
96
97 public bool IsReadOnly {
98 get {
99 return false;
100 }
101 }
102
103 public OdDbEntity this[int index] {
104 get {
105 return getitem(index);
106 }
107 set {
108 setitem(index, value);
109 }
110 }
111
112 public int Capacity {
113 get {
114 return (int)capacity();
115 }
116 set {
117 if (value < size())
118 throw new ArgumentOutOfRangeException("Capacity");
119 reserve((uint)value);
120 }
121 }
122
123 public int Count {
124 get {
125 return (int)size();
126 }
127 }
128
129 public bool IsSynchronized {
130 get {
131 return false;
132 }
133 }
134
135 public void CopyTo(OdDbEntity[] array)
136 {
137 CopyTo(0, array, 0, this.Count);
138 }
139
140 public void CopyTo(OdDbEntity[] array, int arrayIndex)
141 {
142 CopyTo(0, array, arrayIndex, this.Count);
143 }
144
145 public void CopyTo(int index, OdDbEntity[] array, int arrayIndex, int count)
146 {
147 if (array == null)
148 throw new ArgumentNullException("array");
149 if (index < 0)
150 throw new ArgumentOutOfRangeException("index", "Value is less than zero");
151 if (arrayIndex < 0)
152 throw new ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
153 if (count < 0)
154 throw new ArgumentOutOfRangeException("count", "Value is less than zero");
155 if (array.Rank > 1)
156 throw new ArgumentException("Multi dimensional array.", "array");
157 if (index+count > this.Count || arrayIndex+count > array.Length)
158 throw new ArgumentException("Number of elements to copy is too large.");
159 for (int i=0; i<count; i++)
160 array.SetValue(getitemcopy(index+i), arrayIndex+i);
161 }
162
163 System.Collections.Generic.IEnumerator<OdDbEntity> System.Collections.Generic.IEnumerable<OdDbEntity>.GetEnumerator() {
164 return new OdDbEntityArrayEnumerator(this);
165 }
166
167 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
168 return new OdDbEntityArrayEnumerator(this);
169 }
170
174
175 // Type-safe enumerator
180 public class OdDbEntityArrayEnumerator : System.Collections.IEnumerator
181 , System.Collections.Generic.IEnumerator<OdDbEntity>
182 {
183 private OdDbEntityArray collectionRef;
184 private int currentIndex;
185 private object currentObject;
186 private int currentSize;
187
189 collectionRef = collection;
190 currentIndex = -1;
191 currentObject = null;
192 currentSize = collectionRef.Count;
193 }
194
195 // Type-safe iterator Current
197 get {
198 if (currentIndex == -1)
199 throw new InvalidOperationException("Enumeration not started.");
200 if (currentIndex > currentSize - 1)
201 throw new InvalidOperationException("Enumeration finished.");
202 if (currentObject == null)
203 throw new InvalidOperationException("Collection modified.");
204 return (OdDbEntity)currentObject;
205 }
206 }
207
208 // Type-unsafe IEnumerator.Current
209 object System.Collections.IEnumerator.Current {
210 get {
211 return Current;
212 }
213 }
214
215 public bool MoveNext() {
216 int size = collectionRef.Count;
217 bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
218 if (moveOkay) {
219 currentIndex++;
220 currentObject = collectionRef[currentIndex];
221 } else {
222 currentObject = null;
223 }
224 return moveOkay;
225 }
226
227 public void Reset() {
228 currentIndex = -1;
229 currentObject = null;
230 if (collectionRef.Count != currentSize) {
231 throw new InvalidOperationException("Collection modified.");
232 }
233 }
234
235 public void Dispose() {
236 currentIndex = -1;
237 currentObject = null;
238 }
239 }
240
245
250
251 private uint size() {
252 uint ret = TD_DbPINVOKE.OdDbEntityArray_size(swigCPtr);
254 return ret;
255 }
256
257 private uint capacity() {
258 uint ret = TD_DbPINVOKE.OdDbEntityArray_capacity(swigCPtr);
259 if (TD_DbPINVOKE.SWIGPendingException.Pending) throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
260 return ret;
261 }
262
263 private void reserve(uint n) {
264 TD_DbPINVOKE.OdDbEntityArray_reserve(swigCPtr, n);
265 if (TD_DbPINVOKE.SWIGPendingException.Pending) throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
266 }
267
268 public void resize(uint logicalLength) {
269 TD_DbPINVOKE.OdDbEntityArray_resize(swigCPtr, logicalLength);
271 }
272
273 private OdDbEntity getitemcopy(int index) {
274 OdDbEntity ret = (OdDbEntity)Teigha.Core.Helpers.odrxCreateObjectInternalUniversal(typeof(OdDbEntity),TD_DbPINVOKE.OdDbEntityArray_getitemcopy(swigCPtr, index),false); /*createInt 3_2*/
275
277 return ret;
278}
279
280 private OdDbEntity getitem(int index) {
281 global::System.IntPtr cPtr = TD_DbPINVOKE.OdDbEntityArray_getitem(swigCPtr, index);
282 OdDbEntity ret = (cPtr == global::System.IntPtr.Zero) ? null : new OdDbEntity(cPtr, false);
283 if (TD_DbPINVOKE.SWIGPendingException.Pending) throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
284 return ret;
285 }
286
287 private void setitem(int index, OdDbEntity val) {
288 TD_DbPINVOKE.OdDbEntityArray_setitem(swigCPtr, index, OdDbEntity.getCPtr(val));
289 if (TD_DbPINVOKE.SWIGPendingException.Pending) throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
290 }
291
296
297 public OdDbEntityArray GetRange(int index, int count) {
298 global::System.IntPtr cPtr = TD_DbPINVOKE.OdDbEntityArray_GetRange(swigCPtr, index, count);
299 OdDbEntityArray ret = (cPtr == global::System.IntPtr.Zero) ? null : new OdDbEntityArray(cPtr, false);
301 return ret;
302 }
303
308
313
318
319 public void RemoveRange(int index, int count) {
320 TD_DbPINVOKE.OdDbEntityArray_RemoveRange(swigCPtr, index, count);
322 }
323
324 public static OdDbEntityArray Repeat(OdDbEntity value, int count) {
325 global::System.IntPtr cPtr = TD_DbPINVOKE.OdDbEntityArray_Repeat(OdDbEntity.getCPtr(value), count);
326 OdDbEntityArray ret = (cPtr == global::System.IntPtr.Zero) ? null : new OdDbEntityArray(cPtr, true);
328 return ret;
329 }
330
335
336 public void Reverse(int index, int count) {
337 TD_DbPINVOKE.OdDbEntityArray_Reverse__SWIG_1(swigCPtr, index, count);
339 }
340
345
351
357
363
369
370}
371
372}
void CopyTo(int index, OdDbEntity[] array, int arrayIndex, int count)
bool Contains(OdDbEntity value)
void AddRange(OdDbEntityArray values)
void CopyTo(OdDbEntity[] array, int arrayIndex)
void RemoveRange(int index, int count)
OdDbEntityArrayEnumerator GetEnumerator()
virtual void Dispose(bool disposing)
void Insert(int index, OdDbEntity x)
static OdDbEntityArray Repeat(OdDbEntity value, int count)
OdDbEntityArray(bool bGCMemory_Own=false)
void resize(uint logicalLength)
OdDbEntityArray(OdDbEntityArray other, bool bGCMemory_Own=false)
OdDbEntityArray(int capacity, bool bGCMemory_Own=false)
void CopyTo(OdDbEntity[] array)
void InsertRange(int index, OdDbEntityArray values)
void SetRange(int index, OdDbEntityArray values)
OdDbEntityArray(System.Collections.ICollection c)
static HandleRef getCPtr(OdDbEntityArray obj)
OdDbEntityArray(IntPtr cPtr, bool cMemoryOwn)
int IndexOf(OdDbEntity value)
OdDbEntityArray GetRange(int index, int count)
void Reverse(int index, int count)
bool Remove(OdDbEntity value)
int LastIndexOf(OdDbEntity value)
static HandleRef getCPtr(OdDbEntity obj)
Definition OdDbEntity.cs:26
static global::System.Exception Retrieve()
static void OdDbEntityArray_Reverse__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1)
static void OdDbEntityArray_InsertRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static int OdDbEntityArray_LastIndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void OdDbEntityArray_AddRange(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void OdDbEntityArray_Reverse__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static void delete_OdDbEntityArray(global::System.Runtime.InteropServices.HandleRef jarg1)
static void OdDbEntityArray_RemoveAt(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static global::System.IntPtr OdDbEntityArray_GetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static void OdDbEntityArray_Insert(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static uint OdDbEntityArray_size(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool OdDbEntityArray_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void OdDbEntityArray_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void OdDbEntityArray_SetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static void OdDbEntityArray_RemoveRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static bool OdDbEntityArray_Contains(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void OdDbEntityArray_Clear(global::System.Runtime.InteropServices.HandleRef jarg1)
static int OdDbEntityArray_IndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static IntPtr OdDbEntityArray_getitemcopy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static global::System.IntPtr OdDbEntityArray_Repeat(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static void OdDbEntityArray_resize(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2)