Extended .NET SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
PRCStreamsMap.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 PRCStreamsMap : global::System.IDisposable
17 , global::System.Collections.Generic.IDictionary<uint, OdStreamBuf>
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 PRCStreamsMap(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(PRCStreamsMap obj) {
29 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
30 }
31
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 OdStreamBuf this[uint key] {
55 get {
56 return getitem(key);
57 }
58
59 set {
60 setitem(key, value);
61 }
62 }
63
64 public bool TryGetValue(uint key, out OdStreamBuf value) {
65 if (this.ContainsKey(key)) {
66 value = this[key];
67 return true;
68 }
69 value = default(OdStreamBuf);
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<uint> Keys {
86 get {
87 global::System.Collections.Generic.ICollection<uint> keys = new global::System.Collections.Generic.List<uint>();
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<OdStreamBuf> Values {
101 get {
102 global::System.Collections.Generic.ICollection<OdStreamBuf> vals = new global::System.Collections.Generic.List<OdStreamBuf>();
103 foreach (global::System.Collections.Generic.KeyValuePair<uint, OdStreamBuf> pair in this) {
104 vals.Add(pair.Value);
105 }
106 return vals;
107 }
108 }
109
110 public void Add(global::System.Collections.Generic.KeyValuePair<uint, OdStreamBuf> item) {
111 Add(item.Key, item.Value);
112 }
113
114 public bool Remove(global::System.Collections.Generic.KeyValuePair<uint, OdStreamBuf> 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<uint, OdStreamBuf> 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<uint, OdStreamBuf>[] array) {
131 CopyTo(array, 0);
132 }
133
134 public void CopyTo(global::System.Collections.Generic.KeyValuePair<uint, OdStreamBuf>[] 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<uint> keyList = new global::System.Collections.Generic.List<uint>(this.Keys);
145 for (int i = 0; i < keyList.Count; i++) {
146 uint currentKey = keyList[i];
147 array.SetValue(new global::System.Collections.Generic.KeyValuePair<uint, OdStreamBuf>(currentKey, this[currentKey]), arrayIndex+i);
148 }
149 }
150
151 global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<uint, OdStreamBuf>> global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<uint, OdStreamBuf>>.GetEnumerator() {
152 return new PRCStreamsMapEnumerator(this);
153 }
154
155 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
156 return new PRCStreamsMapEnumerator(this);
157 }
158
160 return new PRCStreamsMapEnumerator(this);
161 }
162
163 // Type-safe enumerator
168 public class PRCStreamsMapEnumerator : global::System.Collections.IEnumerator,
169 global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<uint, OdStreamBuf>>
170 {
171 private PRCStreamsMap collectionRef;
172 private global::System.Collections.Generic.IList<uint> keyCollection;
173 private int currentIndex;
174 private object currentObject;
175 private int currentSize;
176
178 collectionRef = collection;
179 keyCollection = new global::System.Collections.Generic.List<uint>(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<uint, OdStreamBuf> 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<uint, OdStreamBuf>)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 uint currentKey = keyCollection[currentIndex];
211 currentObject = new global::System.Collections.Generic.KeyValuePair<uint, OdStreamBuf>(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 PRCStreamsMap() : this(GlobalsPINVOKE.new_PRCStreamsMap__SWIG_0(), true) {
235 }
236
237 public PRCStreamsMap(PRCStreamsMap other) : this(GlobalsPINVOKE.new_PRCStreamsMap__SWIG_1(PRCStreamsMap.getCPtr(other)), true) {
239 }
240
241 private uint size() {
242 uint ret = GlobalsPINVOKE.PRCStreamsMap_size(swigCPtr);
244 return ret;
245 }
246
247 public bool empty() {
248 bool ret = GlobalsPINVOKE.PRCStreamsMap_empty(swigCPtr);
250 return ret;
251 }
252
253 public void Clear() {
256 }
257
258 private OdStreamBuf getitem(uint key) {
259 MemoryManager mMan = MemoryManager.GetMemoryManager();
260 MemoryTransaction mTrans = mMan.GetCurrentTransaction(); // MemoryTransaction #18
261 IntPtr ptr = GlobalsPINVOKE.PRCStreamsMap_getitem(swigCPtr, key);
262
263 OdStreamBuf ret = null;
264 if (null != mTrans)
265 {
266 mTrans.AddObject((OdStreamBuf)Teigha.Core.Helpers.odrxCreateObjectInternalUniversal(typeof(OdStreamBuf),ptr, true));
267 ret = (OdStreamBuf)Teigha.Core.Helpers.odrxCreateObjectInternalUniversal(typeof(OdStreamBuf),ptr, false);
268 }
269 else
270 {
271 ret = (OdStreamBuf)Teigha.Core.Helpers.odrxCreateObjectInternalUniversal(typeof(OdStreamBuf),ptr, true);
272 }
273
274 if (GlobalsPINVOKE.SWIGPendingException.Pending) throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
275 return ret;
276}
277
278 private void setitem(uint key, OdStreamBuf x) {
279 GlobalsPINVOKE.PRCStreamsMap_setitem(swigCPtr, key, OdStreamBuf.getCPtr(x));
280 if (GlobalsPINVOKE.SWIGPendingException.Pending) throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
281 }
282
283 public bool ContainsKey(uint key) {
284 bool ret = GlobalsPINVOKE.PRCStreamsMap_ContainsKey(swigCPtr, key);
286 return ret;
287 }
288
289 public void Add(uint key, OdStreamBuf value) {
292 }
293
294 public bool Remove(uint key) {
295 bool ret = GlobalsPINVOKE.PRCStreamsMap_Remove(swigCPtr, key);
297 return ret;
298 }
299
300 private global::System.IntPtr create_iterator_begin() {
301 global::System.IntPtr ret = GlobalsPINVOKE.PRCStreamsMap_create_iterator_begin(swigCPtr);
303 return ret;
304 }
305
306 private uint get_next_key(global::System.IntPtr swigiterator) {
307 uint ret = GlobalsPINVOKE.PRCStreamsMap_get_next_key(swigCPtr, swigiterator);
308 if (GlobalsPINVOKE.SWIGPendingException.Pending) throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
309 return ret;
310 }
311
312 private void destroy_iterator(global::System.IntPtr swigiterator) {
313 GlobalsPINVOKE.PRCStreamsMap_destroy_iterator(swigCPtr, swigiterator);
314 if (GlobalsPINVOKE.SWIGPendingException.Pending) throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
315 }
316
317}
318
319}
static global::System.Exception Retrieve()
static uint PRCStreamsMap_size(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool PRCStreamsMap_empty(global::System.Runtime.InteropServices.HandleRef jarg1)
static IntPtr PRCStreamsMap_getitem(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2)
static bool PRCStreamsMap_ContainsKey(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2)
static void PRCStreamsMap_Clear(global::System.Runtime.InteropServices.HandleRef jarg1)
static void PRCStreamsMap_Add(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, HandleRef jarg3)
static void delete_PRCStreamsMap(global::System.Runtime.InteropServices.HandleRef jarg1)
static global::System.IntPtr PRCStreamsMap_create_iterator_begin(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool PRCStreamsMap_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2)
static HandleRef getCPtr(OdStreamBuf obj)
Definition: OdStreamBuf.cs:25
global::System.Collections.Generic.KeyValuePair< uint, OdStreamBuf > Current
bool ContainsKey(uint key)
void CopyTo(global::System.Collections.Generic.KeyValuePair< uint, OdStreamBuf >[] array)
bool TryGetValue(uint key, out OdStreamBuf value)
virtual void Dispose(bool disposing)
void CopyTo(global::System.Collections.Generic.KeyValuePair< uint, OdStreamBuf >[] array, int arrayIndex)
PRCStreamsMap(PRCStreamsMap other)
bool Contains(global::System.Collections.Generic.KeyValuePair< uint, OdStreamBuf > item)
void Add(global::System.Collections.Generic.KeyValuePair< uint, OdStreamBuf > item)
PRCStreamsMapEnumerator GetEnumerator()
global::System.Collections.Generic.ICollection< OdStreamBuf > Values
bool Remove(global::System.Collections.Generic.KeyValuePair< uint, OdStreamBuf > item)
global::System.Collections.Generic.ICollection< uint > Keys
PRCStreamsMap(IntPtr cPtr, bool cMemoryOwn)
static HandleRef getCPtr(PRCStreamsMap obj)
void Add(uint key, OdStreamBuf value)