/experimental/cola.interop/cola.interop/TopologyEdgePointPtrVector.cs

https://github.com/wrobell/adaptagrams · C# · 290 lines · 228 code · 47 blank · 15 comment · 44 complexity · dd0808ff6ff786832324a8d626f48b3d MD5 · raw file

  1. /* ----------------------------------------------------------------------------
  2. * This file was automatically generated by SWIG (http://www.swig.org).
  3. * Version 1.3.36
  4. *
  5. * Do not make changes to this file unless you know what you are doing--modify
  6. * the SWIG interface file instead.
  7. * ----------------------------------------------------------------------------- */
  8. namespace org.adaptagrams.cola {
  9. using System;
  10. using System.Runtime.InteropServices;
  11. public class TopologyEdgePointPtrVector : IDisposable, System.Collections.IEnumerable {
  12. private HandleRef swigCPtr;
  13. protected bool swigCMemOwn;
  14. internal TopologyEdgePointPtrVector(IntPtr cPtr, bool cMemoryOwn) {
  15. swigCMemOwn = cMemoryOwn;
  16. swigCPtr = new HandleRef(this, cPtr);
  17. }
  18. internal static HandleRef getCPtr(TopologyEdgePointPtrVector obj) {
  19. return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  20. }
  21. ~TopologyEdgePointPtrVector() {
  22. Dispose();
  23. }
  24. public virtual void Dispose() {
  25. lock(this) {
  26. if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
  27. swigCMemOwn = false;
  28. colaPINVOKE.delete_TopologyEdgePointPtrVector(swigCPtr);
  29. }
  30. swigCPtr = new HandleRef(null, IntPtr.Zero);
  31. GC.SuppressFinalize(this);
  32. }
  33. }
  34. public TopologyEdgePointPtrVector(System.Collections.ICollection c) : this() {
  35. if (c == null)
  36. throw new ArgumentNullException("c");
  37. foreach (EdgePoint element in c) {
  38. this.Add(element);
  39. }
  40. }
  41. public bool IsFixedSize {
  42. get {
  43. return false;
  44. }
  45. }
  46. public bool IsReadOnly {
  47. get {
  48. return false;
  49. }
  50. }
  51. public EdgePoint this[int index] {
  52. get {
  53. return getitem(index);
  54. }
  55. set {
  56. setitem(index, value);
  57. }
  58. }
  59. public int Capacity {
  60. get {
  61. return (int)capacity();
  62. }
  63. set {
  64. if (value < size())
  65. throw new ArgumentOutOfRangeException("Capacity");
  66. reserve((uint)value);
  67. }
  68. }
  69. public int Count {
  70. get {
  71. return (int)size();
  72. }
  73. }
  74. public bool IsSynchronized {
  75. get {
  76. return false;
  77. }
  78. }
  79. public void CopyTo(System.Array array) {
  80. CopyTo(0, array, 0, this.Count);
  81. }
  82. public void CopyTo(System.Array array, int arrayIndex) {
  83. CopyTo(0, array, arrayIndex, this.Count);
  84. }
  85. public void CopyTo(int index, System.Array array, int arrayIndex, int count) {
  86. if (array == null)
  87. throw new ArgumentNullException("array");
  88. if (index < 0)
  89. throw new ArgumentOutOfRangeException("index", "Value is less than zero");
  90. if (arrayIndex < 0)
  91. throw new ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
  92. if (count < 0)
  93. throw new ArgumentOutOfRangeException("count", "Value is less than zero");
  94. if (array.Rank > 1)
  95. throw new ArgumentException("Multi dimensional array.");
  96. if (index+count > this.Count || arrayIndex+count > array.Length)
  97. throw new ArgumentException("Number of elements to copy is too large.");
  98. for (int i=0; i<count; i++)
  99. array.SetValue(getitemcopy(index+i), arrayIndex+i);
  100. }
  101. // Type-safe version of IEnumerable.GetEnumerator
  102. System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
  103. return new TopologyEdgePointPtrVectorEnumerator(this);
  104. }
  105. public TopologyEdgePointPtrVectorEnumerator GetEnumerator() {
  106. return new TopologyEdgePointPtrVectorEnumerator(this);
  107. }
  108. // Type-safe enumerator
  109. /// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
  110. /// whenever the collection is modified. This has been done for changes in the size of the
  111. /// collection but not when one of the elements of the collection is modified as it is a bit
  112. /// tricky to detect unmanaged code that modifies the collection under our feet.
  113. public sealed class TopologyEdgePointPtrVectorEnumerator : System.Collections.IEnumerator {
  114. private TopologyEdgePointPtrVector collectionRef;
  115. private int currentIndex;
  116. private object currentObject;
  117. private int currentSize;
  118. public TopologyEdgePointPtrVectorEnumerator(TopologyEdgePointPtrVector collection) {
  119. collectionRef = collection;
  120. currentIndex = -1;
  121. currentObject = null;
  122. currentSize = collectionRef.Count;
  123. }
  124. // Type-safe iterator Current
  125. public EdgePoint Current {
  126. get {
  127. if (currentIndex == -1)
  128. throw new InvalidOperationException("Enumeration not started.");
  129. if (currentIndex > currentSize - 1)
  130. throw new InvalidOperationException("Enumeration finished.");
  131. if (currentObject == null)
  132. throw new InvalidOperationException("Collection modified.");
  133. return (EdgePoint)currentObject;
  134. }
  135. }
  136. // Type-unsafe IEnumerator.Current
  137. object System.Collections.IEnumerator.Current {
  138. get {
  139. return Current;
  140. }
  141. }
  142. public bool MoveNext() {
  143. int size = collectionRef.Count;
  144. bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
  145. if (moveOkay) {
  146. currentIndex++;
  147. currentObject = collectionRef[currentIndex];
  148. } else {
  149. currentObject = null;
  150. }
  151. return moveOkay;
  152. }
  153. public void Reset() {
  154. currentIndex = -1;
  155. currentObject = null;
  156. if (collectionRef.Count != currentSize) {
  157. throw new InvalidOperationException("Collection modified.");
  158. }
  159. }
  160. }
  161. public void Clear() {
  162. colaPINVOKE.TopologyEdgePointPtrVector_Clear(swigCPtr);
  163. }
  164. public void Add(EdgePoint x) {
  165. colaPINVOKE.TopologyEdgePointPtrVector_Add(swigCPtr, EdgePoint.getCPtr(x));
  166. }
  167. private uint size() {
  168. uint ret = colaPINVOKE.TopologyEdgePointPtrVector_size(swigCPtr);
  169. return ret;
  170. }
  171. private uint capacity() {
  172. uint ret = colaPINVOKE.TopologyEdgePointPtrVector_capacity(swigCPtr);
  173. return ret;
  174. }
  175. private void reserve(uint n) {
  176. colaPINVOKE.TopologyEdgePointPtrVector_reserve(swigCPtr, n);
  177. }
  178. public TopologyEdgePointPtrVector() : this(colaPINVOKE.new_TopologyEdgePointPtrVector__SWIG_0(), true) {
  179. }
  180. public TopologyEdgePointPtrVector(int capacity) : this(colaPINVOKE.new_TopologyEdgePointPtrVector__SWIG_1(capacity), true) {
  181. if (colaPINVOKE.SWIGPendingException.Pending) throw colaPINVOKE.SWIGPendingException.Retrieve();
  182. }
  183. private EdgePoint getitemcopy(int index) {
  184. IntPtr cPtr = colaPINVOKE.TopologyEdgePointPtrVector_getitemcopy(swigCPtr, index);
  185. EdgePoint ret = (cPtr == IntPtr.Zero) ? null : new EdgePoint(cPtr, false);
  186. if (colaPINVOKE.SWIGPendingException.Pending) throw colaPINVOKE.SWIGPendingException.Retrieve();
  187. return ret;
  188. }
  189. private EdgePoint getitem(int index) {
  190. IntPtr cPtr = colaPINVOKE.TopologyEdgePointPtrVector_getitem(swigCPtr, index);
  191. EdgePoint ret = (cPtr == IntPtr.Zero) ? null : new EdgePoint(cPtr, false);
  192. if (colaPINVOKE.SWIGPendingException.Pending) throw colaPINVOKE.SWIGPendingException.Retrieve();
  193. return ret;
  194. }
  195. private void setitem(int index, EdgePoint val) {
  196. colaPINVOKE.TopologyEdgePointPtrVector_setitem(swigCPtr, index, EdgePoint.getCPtr(val));
  197. if (colaPINVOKE.SWIGPendingException.Pending) throw colaPINVOKE.SWIGPendingException.Retrieve();
  198. }
  199. public void AddRange(TopologyEdgePointPtrVector values) {
  200. colaPINVOKE.TopologyEdgePointPtrVector_AddRange(swigCPtr, TopologyEdgePointPtrVector.getCPtr(values));
  201. if (colaPINVOKE.SWIGPendingException.Pending) throw colaPINVOKE.SWIGPendingException.Retrieve();
  202. }
  203. public TopologyEdgePointPtrVector GetRange(int index, int count) {
  204. IntPtr cPtr = colaPINVOKE.TopologyEdgePointPtrVector_GetRange(swigCPtr, index, count);
  205. TopologyEdgePointPtrVector ret = (cPtr == IntPtr.Zero) ? null : new TopologyEdgePointPtrVector(cPtr, true);
  206. if (colaPINVOKE.SWIGPendingException.Pending) throw colaPINVOKE.SWIGPendingException.Retrieve();
  207. return ret;
  208. }
  209. public void Insert(int index, EdgePoint x) {
  210. colaPINVOKE.TopologyEdgePointPtrVector_Insert(swigCPtr, index, EdgePoint.getCPtr(x));
  211. if (colaPINVOKE.SWIGPendingException.Pending) throw colaPINVOKE.SWIGPendingException.Retrieve();
  212. }
  213. public void InsertRange(int index, TopologyEdgePointPtrVector values) {
  214. colaPINVOKE.TopologyEdgePointPtrVector_InsertRange(swigCPtr, index, TopologyEdgePointPtrVector.getCPtr(values));
  215. if (colaPINVOKE.SWIGPendingException.Pending) throw colaPINVOKE.SWIGPendingException.Retrieve();
  216. }
  217. public void RemoveAt(int index) {
  218. colaPINVOKE.TopologyEdgePointPtrVector_RemoveAt(swigCPtr, index);
  219. if (colaPINVOKE.SWIGPendingException.Pending) throw colaPINVOKE.SWIGPendingException.Retrieve();
  220. }
  221. public void RemoveRange(int index, int count) {
  222. colaPINVOKE.TopologyEdgePointPtrVector_RemoveRange(swigCPtr, index, count);
  223. if (colaPINVOKE.SWIGPendingException.Pending) throw colaPINVOKE.SWIGPendingException.Retrieve();
  224. }
  225. public static TopologyEdgePointPtrVector Repeat(EdgePoint value, int count) {
  226. IntPtr cPtr = colaPINVOKE.TopologyEdgePointPtrVector_Repeat(EdgePoint.getCPtr(value), count);
  227. TopologyEdgePointPtrVector ret = (cPtr == IntPtr.Zero) ? null : new TopologyEdgePointPtrVector(cPtr, true);
  228. if (colaPINVOKE.SWIGPendingException.Pending) throw colaPINVOKE.SWIGPendingException.Retrieve();
  229. return ret;
  230. }
  231. public void Reverse() {
  232. colaPINVOKE.TopologyEdgePointPtrVector_Reverse__SWIG_0(swigCPtr);
  233. }
  234. public void Reverse(int index, int count) {
  235. colaPINVOKE.TopologyEdgePointPtrVector_Reverse__SWIG_1(swigCPtr, index, count);
  236. if (colaPINVOKE.SWIGPendingException.Pending) throw colaPINVOKE.SWIGPendingException.Retrieve();
  237. }
  238. public void SetRange(int index, TopologyEdgePointPtrVector values) {
  239. colaPINVOKE.TopologyEdgePointPtrVector_SetRange(swigCPtr, index, TopologyEdgePointPtrVector.getCPtr(values));
  240. if (colaPINVOKE.SWIGPendingException.Pending) throw colaPINVOKE.SWIGPendingException.Retrieve();
  241. }
  242. }
  243. }