Extended .NET SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
OdIdIdMap.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 OdIdIdMap : global::System.IDisposable
17 , global::System.Collections.Generic.IDictionary<ulong, ulong>
18 {
19 private Object locker = new Object();
20 private HandleRef swigCPtr;
21 protected bool swigCMemOwn;
22 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
23 public OdIdIdMap(IntPtr cPtr, bool cMemoryOwn) {
24 swigCMemOwn = cMemoryOwn;
25 swigCPtr = new HandleRef(this, cPtr);
26 }
27 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
28 public static HandleRef getCPtr(OdIdIdMap obj) {
29 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
30 }
31
32 ~OdIdIdMap() {
33 Dispose(false);
34 }
35
36 public void Dispose() {
37 Dispose(true);
38 global::System.GC.SuppressFinalize(this);
39 }
40
41 protected virtual void Dispose(bool disposing) {
42 lock(this) {
43 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
44 if (swigCMemOwn) {
45 swigCMemOwn = false;
47 }
48 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
49 }
50 }
51 }
52
53
54 public ulong this[ulong key] {
55 get {
56 return getitem(key);
57 }
58
59 set {
60 setitem(key, value);
61 }
62 }
63
64 public bool TryGetValue(ulong key, out ulong value) {
65 if (this.ContainsKey(key)) {
66 value = this[key];
67 return true;
68 }
69 value = default(ulong);
70 return false;
71 }
72
73 public int Count {
74 get {
75 return (int)size();
76 }
77 }
78
79 public bool IsReadOnly {
80 get {
81 return false;
82 }
83 }
84
85 public global::System.Collections.Generic.ICollection<ulong> Keys {
86 get {
87 global::System.Collections.Generic.ICollection<ulong> keys = new global::System.Collections.Generic.List<ulong>();
88 int size = this.Count;
89 if (size > 0) {
90 global::System.IntPtr iter = create_iterator_begin();
91 for (int i = 0; i < size; i++) {
92 keys.Add(get_next_key(iter));
93 }
94 destroy_iterator(iter);
95 }
96 return keys;
97 }
98 }
99
100 public global::System.Collections.Generic.ICollection<ulong> Values {
101 get {
102 global::System.Collections.Generic.ICollection<ulong> vals = new global::System.Collections.Generic.List<ulong>();
103 foreach (global::System.Collections.Generic.KeyValuePair<ulong, ulong> pair in this) {
104 vals.Add(pair.Value);
105 }
106 return vals;
107 }
108 }
109
110 public void Add(global::System.Collections.Generic.KeyValuePair<ulong, ulong> item) {
111 Add(item.Key, item.Value);
112 }
113
114 public bool Remove(global::System.Collections.Generic.KeyValuePair<ulong, ulong> item) {
115 if (Contains(item)) {
116 return Remove(item.Key);
117 } else {
118 return false;
119 }
120 }
121
122 public bool Contains(global::System.Collections.Generic.KeyValuePair<ulong, ulong> item) {
123 if (this[item.Key] == item.Value) {
124 return true;
125 } else {
126 return false;
127 }
128 }
129
130 public void CopyTo(global::System.Collections.Generic.KeyValuePair<ulong, ulong>[] array) {
131 CopyTo(array, 0);
132 }
133
134 public void CopyTo(global::System.Collections.Generic.KeyValuePair<ulong, ulong>[] array, int arrayIndex) {
135 if (array == null)
136 throw new global::System.ArgumentNullException("array");
137 if (arrayIndex < 0)
138 throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
139 if (array.Rank > 1)
140 throw new global::System.ArgumentException("Multi dimensional array.", "array");
141 if (arrayIndex+this.Count > array.Length)
142 throw new global::System.ArgumentException("Number of elements to copy is too large.");
143
144 global::System.Collections.Generic.IList<ulong> keyList = new global::System.Collections.Generic.List<ulong>(this.Keys);
145 for (int i = 0; i < keyList.Count; i++) {
146 ulong currentKey = keyList[i];
147 array.SetValue(new global::System.Collections.Generic.KeyValuePair<ulong, ulong>(currentKey, this[currentKey]), arrayIndex+i);
148 }
149 }
150
151 global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<ulong, ulong>> global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<ulong, ulong>>.GetEnumerator() {
152 return new OdIdIdMapEnumerator(this);
153 }
154
155 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
156 return new OdIdIdMapEnumerator(this);
157 }
158
160 return new OdIdIdMapEnumerator(this);
161 }
162
163 // Type-safe enumerator
168 public class OdIdIdMapEnumerator : global::System.Collections.IEnumerator,
169 global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<ulong, ulong>>
170 {
171 private OdIdIdMap collectionRef;
172 private global::System.Collections.Generic.IList<ulong> keyCollection;
173 private int currentIndex;
174 private object currentObject;
175 private int currentSize;
176
177 public OdIdIdMapEnumerator(OdIdIdMap collection) {
178 collectionRef = collection;
179 keyCollection = new global::System.Collections.Generic.List<ulong>(collection.Keys);
180 currentIndex = -1;
181 currentObject = null;
182 currentSize = collectionRef.Count;
183 }
184
185 // Type-safe iterator Current
186 public global::System.Collections.Generic.KeyValuePair<ulong, ulong> Current {
187 get {
188 if (currentIndex == -1)
189 throw new global::System.InvalidOperationException("Enumeration not started.");
190 if (currentIndex > currentSize - 1)
191 throw new global::System.InvalidOperationException("Enumeration finished.");
192 if (currentObject == null)
193 throw new global::System.InvalidOperationException("Collection modified.");
194 return (global::System.Collections.Generic.KeyValuePair<ulong, ulong>)currentObject;
195 }
196 }
197
198 // Type-unsafe IEnumerator.Current
199 object global::System.Collections.IEnumerator.Current {
200 get {
201 return Current;
202 }
203 }
204
205 public bool MoveNext() {
206 int size = collectionRef.Count;
207 bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
208 if (moveOkay) {
209 currentIndex++;
210 ulong currentKey = keyCollection[currentIndex];
211 currentObject = new global::System.Collections.Generic.KeyValuePair<ulong, ulong>(currentKey, collectionRef[currentKey]);
212 } else {
213 currentObject = null;
214 }
215 return moveOkay;
216 }
217
218 public void Reset() {
219 currentIndex = -1;
220 currentObject = null;
221 if (collectionRef.Count != currentSize) {
222 throw new global::System.InvalidOperationException("Collection modified.");
223 }
224 }
225
226 public void Dispose() {
227 currentIndex = -1;
228 currentObject = null;
229 }
230 }
231
232
233 public OdIdIdMap() : this(GlobalsPINVOKE.new_OdIdIdMap__SWIG_0(), true) {
235 }
236
237 public OdIdIdMap(OdIdIdMap other) : this(GlobalsPINVOKE.new_OdIdIdMap__SWIG_1(OdIdIdMap.getCPtr(other)), true) {
239 }
240
241 private uint size() {
242 uint ret = GlobalsPINVOKE.OdIdIdMap_size(swigCPtr);
244 return ret;
245 }
246
247 public bool empty() {
248 bool ret = GlobalsPINVOKE.OdIdIdMap_empty(swigCPtr);
250 return ret;
251 }
252
253 public void Clear() {
256 }
257
258 private ulong getitem(ulong key) {
259 ulong ret = GlobalsPINVOKE.OdIdIdMap_getitem(swigCPtr, key);
261 return ret;
262 }
263
264 private void setitem(ulong key, ulong x) {
265 GlobalsPINVOKE.OdIdIdMap_setitem(swigCPtr, key, x);
266 if (GlobalsPINVOKE.SWIGPendingException.Pending) throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
267 }
268
269 public bool ContainsKey(ulong key) {
270 bool ret = GlobalsPINVOKE.OdIdIdMap_ContainsKey(swigCPtr, key);
272 return ret;
273 }
274
275 public void Add(ulong key, ulong value) {
276 GlobalsPINVOKE.OdIdIdMap_Add(swigCPtr, key, value);
278 }
279
280 public bool Remove(ulong key) {
281 bool ret = GlobalsPINVOKE.OdIdIdMap_Remove(swigCPtr, key);
283 return ret;
284 }
285
286 private global::System.IntPtr create_iterator_begin() {
287 global::System.IntPtr ret = GlobalsPINVOKE.OdIdIdMap_create_iterator_begin(swigCPtr);
289 return ret;
290 }
291
292 private ulong get_next_key(global::System.IntPtr swigiterator) {
293 ulong ret = GlobalsPINVOKE.OdIdIdMap_get_next_key(swigCPtr, swigiterator);
294 if (GlobalsPINVOKE.SWIGPendingException.Pending) throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
295 return ret;
296 }
297
298 private void destroy_iterator(global::System.IntPtr swigiterator) {
299 GlobalsPINVOKE.OdIdIdMap_destroy_iterator(swigCPtr, swigiterator);
300 if (GlobalsPINVOKE.SWIGPendingException.Pending) throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
301 }
302
303}
304
305}
static global::System.Exception Retrieve()
static global::System.IntPtr OdIdIdMap_create_iterator_begin(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool OdIdIdMap_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, ulong jarg2)
static bool OdIdIdMap_empty(global::System.Runtime.InteropServices.HandleRef jarg1)
static void delete_OdIdIdMap(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool OdIdIdMap_ContainsKey(global::System.Runtime.InteropServices.HandleRef jarg1, ulong jarg2)
static uint OdIdIdMap_size(global::System.Runtime.InteropServices.HandleRef jarg1)
static ulong OdIdIdMap_getitem(global::System.Runtime.InteropServices.HandleRef jarg1, ulong jarg2)
static void OdIdIdMap_Add(global::System.Runtime.InteropServices.HandleRef jarg1, ulong jarg2, ulong jarg3)
static void OdIdIdMap_Clear(global::System.Runtime.InteropServices.HandleRef jarg1)
OdIdIdMapEnumerator(OdIdIdMap collection)
Definition: OdIdIdMap.cs:177
global::System.Collections.Generic.KeyValuePair< ulong, ulong > Current
Definition: OdIdIdMap.cs:186
void CopyTo(global::System.Collections.Generic.KeyValuePair< ulong, ulong >[] array, int arrayIndex)
Definition: OdIdIdMap.cs:134
static HandleRef getCPtr(OdIdIdMap obj)
Definition: OdIdIdMap.cs:28
bool Contains(global::System.Collections.Generic.KeyValuePair< ulong, ulong > item)
Definition: OdIdIdMap.cs:122
virtual void Dispose(bool disposing)
Definition: OdIdIdMap.cs:41
bool Remove(global::System.Collections.Generic.KeyValuePair< ulong, ulong > item)
Definition: OdIdIdMap.cs:114
bool Remove(ulong key)
Definition: OdIdIdMap.cs:280
void Add(ulong key, ulong value)
Definition: OdIdIdMap.cs:275
bool ContainsKey(ulong key)
Definition: OdIdIdMap.cs:269
bool TryGetValue(ulong key, out ulong value)
Definition: OdIdIdMap.cs:64
void CopyTo(global::System.Collections.Generic.KeyValuePair< ulong, ulong >[] array)
Definition: OdIdIdMap.cs:130
global::System.Collections.Generic.ICollection< ulong > Values
Definition: OdIdIdMap.cs:100
OdIdIdMapEnumerator GetEnumerator()
Definition: OdIdIdMap.cs:159
OdIdIdMap(OdIdIdMap other)
Definition: OdIdIdMap.cs:237
global::System.Collections.Generic.ICollection< ulong > Keys
Definition: OdIdIdMap.cs:85
void Add(global::System.Collections.Generic.KeyValuePair< ulong, ulong > item)
Definition: OdIdIdMap.cs:110
OdIdIdMap(IntPtr cPtr, bool cMemoryOwn)
Definition: OdIdIdMap.cs:23