Extended .NET SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
MapVariableId.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.TG {
12
13using System;
14using System.Runtime.InteropServices;
15using Teigha.Core;
16
17public class MapVariableId : global::System.IDisposable
18 , global::System.Collections.Generic.IDictionary<OdDgElementId, OdDgVariableValueVariant>
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 MapVariableId(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(MapVariableId 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
56 get {
57 return getitem(key);
58 }
59
60 set {
61 setitem(key, value);
62 }
63 }
64
66 if (this.ContainsKey(key)) {
67 value = this[key];
68 return true;
69 }
71 return false;
72 }
73
74 public int Count {
75 get {
76 return (int)size();
77 }
78 }
79
80 public bool IsReadOnly {
81 get {
82 return false;
83 }
84 }
85
86 public global::System.Collections.Generic.ICollection<OdDgElementId> Keys {
87 get {
88 global::System.Collections.Generic.ICollection<OdDgElementId> keys = new global::System.Collections.Generic.List<OdDgElementId>();
89 int size = this.Count;
90 if (size > 0) {
91 global::System.IntPtr iter = create_iterator_begin();
92 for (int i = 0; i < size; i++) {
93 keys.Add(get_next_key(iter));
94 }
95 destroy_iterator(iter);
96 }
97 return keys;
98 }
99 }
100
101 public global::System.Collections.Generic.ICollection<OdDgVariableValueVariant> Values {
102 get {
103 global::System.Collections.Generic.ICollection<OdDgVariableValueVariant> vals = new global::System.Collections.Generic.List<OdDgVariableValueVariant>();
104 foreach (global::System.Collections.Generic.KeyValuePair<OdDgElementId, OdDgVariableValueVariant> pair in this) {
105 vals.Add(pair.Value);
106 }
107 return vals;
108 }
109 }
110
111 public void Add(global::System.Collections.Generic.KeyValuePair<OdDgElementId, OdDgVariableValueVariant> item) {
112 Add(item.Key, item.Value);
113 }
114
115 public bool Remove(global::System.Collections.Generic.KeyValuePair<OdDgElementId, OdDgVariableValueVariant> item) {
116 if (Contains(item)) {
117 return Remove(item.Key);
118 } else {
119 return false;
120 }
121 }
122
123 public bool Contains(global::System.Collections.Generic.KeyValuePair<OdDgElementId, OdDgVariableValueVariant> item) {
124 if (this[item.Key] == item.Value) {
125 return true;
126 } else {
127 return false;
128 }
129 }
130
131 public void CopyTo(global::System.Collections.Generic.KeyValuePair<OdDgElementId, OdDgVariableValueVariant>[] array) {
132 CopyTo(array, 0);
133 }
134
135 public void CopyTo(global::System.Collections.Generic.KeyValuePair<OdDgElementId, OdDgVariableValueVariant>[] array, int arrayIndex) {
136 if (array == null)
137 throw new global::System.ArgumentNullException("array");
138 if (arrayIndex < 0)
139 throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
140 if (array.Rank > 1)
141 throw new global::System.ArgumentException("Multi dimensional array.", "array");
142 if (arrayIndex+this.Count > array.Length)
143 throw new global::System.ArgumentException("Number of elements to copy is too large.");
144
145 global::System.Collections.Generic.IList<OdDgElementId> keyList = new global::System.Collections.Generic.List<OdDgElementId>(this.Keys);
146 for (int i = 0; i < keyList.Count; i++) {
147 OdDgElementId currentKey = keyList[i];
148 array.SetValue(new global::System.Collections.Generic.KeyValuePair<OdDgElementId, OdDgVariableValueVariant>(currentKey, this[currentKey]), arrayIndex+i);
149 }
150 }
151
152 global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<OdDgElementId, OdDgVariableValueVariant>> global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<OdDgElementId, OdDgVariableValueVariant>>.GetEnumerator() {
153 return new MapVariableIdEnumerator(this);
154 }
155
156 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
157 return new MapVariableIdEnumerator(this);
158 }
159
161 return new MapVariableIdEnumerator(this);
162 }
163
164 // Type-safe enumerator
169 public class MapVariableIdEnumerator : global::System.Collections.IEnumerator,
170 global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<OdDgElementId, OdDgVariableValueVariant>>
171 {
172 private MapVariableId collectionRef;
173 private global::System.Collections.Generic.IList<OdDgElementId> keyCollection;
174 private int currentIndex;
175 private object currentObject;
176 private int currentSize;
177
179 collectionRef = collection;
180 keyCollection = new global::System.Collections.Generic.List<OdDgElementId>(collection.Keys);
181 currentIndex = -1;
182 currentObject = null;
183 currentSize = collectionRef.Count;
184 }
185
186 // Type-safe iterator Current
187 public global::System.Collections.Generic.KeyValuePair<OdDgElementId, OdDgVariableValueVariant> Current {
188 get {
189 if (currentIndex == -1)
190 throw new global::System.InvalidOperationException("Enumeration not started.");
191 if (currentIndex > currentSize - 1)
192 throw new global::System.InvalidOperationException("Enumeration finished.");
193 if (currentObject == null)
194 throw new global::System.InvalidOperationException("Collection modified.");
195 return (global::System.Collections.Generic.KeyValuePair<OdDgElementId, OdDgVariableValueVariant>)currentObject;
196 }
197 }
198
199 // Type-unsafe IEnumerator.Current
200 object global::System.Collections.IEnumerator.Current {
201 get {
202 return Current;
203 }
204 }
205
206 public bool MoveNext() {
207 int size = collectionRef.Count;
208 bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
209 if (moveOkay) {
210 currentIndex++;
211 OdDgElementId currentKey = keyCollection[currentIndex];
212 currentObject = new global::System.Collections.Generic.KeyValuePair<OdDgElementId, OdDgVariableValueVariant>(currentKey, collectionRef[currentKey]);
213 } else {
214 currentObject = null;
215 }
216 return moveOkay;
217 }
218
219 public void Reset() {
220 currentIndex = -1;
221 currentObject = null;
222 if (collectionRef.Count != currentSize) {
223 throw new global::System.InvalidOperationException("Collection modified.");
224 }
225 }
226
227 public void Dispose() {
228 currentIndex = -1;
229 currentObject = null;
230 }
231 }
232
233
234 public MapVariableId() : this(TG_DbPINVOKE.new_MapVariableId__SWIG_0(), true) {
236 }
237
238 public MapVariableId(MapVariableId other) : this(TG_DbPINVOKE.new_MapVariableId__SWIG_1(MapVariableId.getCPtr(other)), true) {
240 }
241
242 private uint size() {
243 uint ret = TG_DbPINVOKE.MapVariableId_size(swigCPtr);
245 return ret;
246 }
247
248 public bool empty() {
249 bool ret = TG_DbPINVOKE.MapVariableId_empty(swigCPtr);
251 return ret;
252 }
253
254 public void Clear() {
257 }
258
259 private OdDgVariableValueVariant getitem(OdDgElementId key) {
262 return ret;
263 }
264
265 private void setitem(OdDgElementId key, OdDgVariableValueVariant x) {
266 TG_DbPINVOKE.MapVariableId_setitem(swigCPtr, OdDgElementId.getCPtr(key), OdDgVariableValueVariant.getCPtr(x));
267 if (TG_DbPINVOKE.SWIGPendingException.Pending) throw TG_DbPINVOKE.SWIGPendingException.Retrieve();
268 }
269
270 public bool ContainsKey(OdDgElementId key) {
273 return ret;
274 }
275
279 }
280
281 public bool Remove(OdDgElementId key) {
282 bool ret = TG_DbPINVOKE.MapVariableId_Remove(swigCPtr, OdDgElementId.getCPtr(key));
284 return ret;
285 }
286
287 private global::System.IntPtr create_iterator_begin() {
288 global::System.IntPtr ret = TG_DbPINVOKE.MapVariableId_create_iterator_begin(swigCPtr);
290 return ret;
291 }
292
293 private OdDgElementId get_next_key(global::System.IntPtr swigiterator) {
294 OdDgElementId ret = new OdDgElementId(TG_DbPINVOKE.MapVariableId_get_next_key(swigCPtr, swigiterator), false);
295 if (TG_DbPINVOKE.SWIGPendingException.Pending) throw TG_DbPINVOKE.SWIGPendingException.Retrieve();
296 return ret;
297 }
298
299 private void destroy_iterator(global::System.IntPtr swigiterator) {
300 TG_DbPINVOKE.MapVariableId_destroy_iterator(swigCPtr, swigiterator);
301 if (TG_DbPINVOKE.SWIGPendingException.Pending) throw TG_DbPINVOKE.SWIGPendingException.Retrieve();
302 }
303
304}
305
306}
global::System.Collections.Generic.KeyValuePair< OdDgElementId, OdDgVariableValueVariant > Current
MapVariableIdEnumerator(MapVariableId collection)
bool Remove(global::System.Collections.Generic.KeyValuePair< OdDgElementId, OdDgVariableValueVariant > item)
void CopyTo(global::System.Collections.Generic.KeyValuePair< OdDgElementId, OdDgVariableValueVariant >[] array, int arrayIndex)
MapVariableId(MapVariableId other)
void Add(OdDgElementId key, OdDgVariableValueVariant value)
bool Contains(global::System.Collections.Generic.KeyValuePair< OdDgElementId, OdDgVariableValueVariant > item)
static HandleRef getCPtr(MapVariableId obj)
bool ContainsKey(OdDgElementId key)
bool TryGetValue(OdDgElementId key, out OdDgVariableValueVariant value)
virtual void Dispose(bool disposing)
void Add(global::System.Collections.Generic.KeyValuePair< OdDgElementId, OdDgVariableValueVariant > item)
MapVariableIdEnumerator GetEnumerator()
bool Remove(OdDgElementId key)
global::System.Collections.Generic.ICollection< OdDgVariableValueVariant > Values
MapVariableId(IntPtr cPtr, bool cMemoryOwn)
global::System.Collections.Generic.ICollection< OdDgElementId > Keys
void CopyTo(global::System.Collections.Generic.KeyValuePair< OdDgElementId, OdDgVariableValueVariant >[] array)
static HandleRef getCPtr(OdDgElementId obj)
static HandleRef getCPtr(OdDgVariableValueVariant obj)
static global::System.Exception Retrieve()
static global::System.IntPtr MapVariableId_create_iterator_begin(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool MapVariableId_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static bool MapVariableId_empty(global::System.Runtime.InteropServices.HandleRef jarg1)
static void MapVariableId_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static uint MapVariableId_size(global::System.Runtime.InteropServices.HandleRef jarg1)
static void MapVariableId_Clear(global::System.Runtime.InteropServices.HandleRef jarg1)
static void delete_MapVariableId(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool MapVariableId_ContainsKey(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static global::System.IntPtr MapVariableId_getitem(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)