//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 4.0.2
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------

namespace  Nlc {

public class OdIndexVector : global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerable< Nlc.OdIndex >
 {
  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
  protected bool swigCMemOwn;

  internal OdIndexVector(global::System.IntPtr cPtr, bool cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
  }

  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(OdIndexVector obj) {
    return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
  }

  ~OdIndexVector() {
    Dispose(false);
  }

  public void Dispose() {
    Dispose(true);
    global::System.GC.SuppressFinalize(this);
  }

  protected virtual void Dispose(bool disposing) {
    lock(this) {
      if (swigCPtr.Handle != global::System.IntPtr.Zero) {
        if (swigCMemOwn) {
          swigCMemOwn = false;
          NanolibPINVOKE.delete_OdIndexVector(swigCPtr);
        }
        swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
      }
    }
  }

  public OdIndexVector(global::System.Collections.IEnumerable c) : this() {
    if (c == null)
      throw new global::System.ArgumentNullException("c");
    foreach ( Nlc.OdIndex  element in c) {
      this.Add(element);
    }
  }

  public OdIndexVector(global::System.Collections.Generic.IEnumerable< Nlc.OdIndex > c) : this() {
    if (c == null)
      throw new global::System.ArgumentNullException("c");
    foreach ( Nlc.OdIndex  element in c) {
      this.Add(element);
    }
  }

  public bool IsFixedSize {
    get {
      return false;
    }
  }

  public bool IsReadOnly {
    get {
      return false;
    }
  }

  public  Nlc.OdIndex  this[int index]  {
    get {
      return getitem(index);
    }
    set {
      setitem(index, value);
    }
  }

  public int Capacity {
    get {
      return (int)capacity();
    }
    set {
      if (value < size())
        throw new global::System.ArgumentOutOfRangeException("Capacity");
      reserve((uint)value);
    }
  }

  public int Count {
    get {
      return (int)size();
    }
  }

  public bool IsSynchronized {
    get {
      return false;
    }
  }

  public void CopyTo( Nlc.OdIndex [] array)
  {
    CopyTo(0, array, 0, this.Count);
  }

  public void CopyTo( Nlc.OdIndex [] array, int arrayIndex)
  {
    CopyTo(0, array, arrayIndex, this.Count);
  }

  public void CopyTo(int index,  Nlc.OdIndex [] array, int arrayIndex, int count)
  {
    if (array == null)
      throw new global::System.ArgumentNullException("array");
    if (index < 0)
      throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
    if (arrayIndex < 0)
      throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
    if (count < 0)
      throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero");
    if (array.Rank > 1)
      throw new global::System.ArgumentException("Multi dimensional array.", "array");
    if (index+count > this.Count || arrayIndex+count > array.Length)
      throw new global::System.ArgumentException("Number of elements to copy is too large.");
    for (int i=0; i<count; i++)
      array.SetValue(getitemcopy(index+i), arrayIndex+i);
  }

  public  Nlc.OdIndex [] ToArray() {
     Nlc.OdIndex [] array = new  Nlc.OdIndex [this.Count];
    this.CopyTo(array);
    return array;
  }

  global::System.Collections.Generic.IEnumerator< Nlc.OdIndex > global::System.Collections.Generic.IEnumerable< Nlc.OdIndex >.GetEnumerator() {
    return new OdIndexVectorEnumerator(this);
  }

  global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
    return new OdIndexVectorEnumerator(this);
  }

  public OdIndexVectorEnumerator GetEnumerator() {
    return new OdIndexVectorEnumerator(this);
  }

  // Type-safe enumerator
  /// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
  /// whenever the collection is modified. This has been done for changes in the size of the
  /// collection but not when one of the elements of the collection is modified as it is a bit
  /// tricky to detect unmanaged code that modifies the collection under our feet.
  public sealed class OdIndexVectorEnumerator : global::System.Collections.IEnumerator
    , global::System.Collections.Generic.IEnumerator< Nlc.OdIndex >
  {
    private OdIndexVector collectionRef;
    private int currentIndex;
    private object currentObject;
    private int currentSize;

    public OdIndexVectorEnumerator(OdIndexVector collection) {
      collectionRef = collection;
      currentIndex = -1;
      currentObject = null;
      currentSize = collectionRef.Count;
    }

    // Type-safe iterator Current
    public  Nlc.OdIndex  Current {
      get {
        if (currentIndex == -1)
          throw new global::System.InvalidOperationException("Enumeration not started.");
        if (currentIndex > currentSize - 1)
          throw new global::System.InvalidOperationException("Enumeration finished.");
        if (currentObject == null)
          throw new global::System.InvalidOperationException("Collection modified.");
        return ( Nlc.OdIndex )currentObject;
      }
    }

    // Type-unsafe IEnumerator.Current
    object global::System.Collections.IEnumerator.Current {
      get {
        return Current;
      }
    }

    public bool MoveNext() {
      int size = collectionRef.Count;
      bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
      if (moveOkay) {
        currentIndex++;
        currentObject = collectionRef[currentIndex];
      } else {
        currentObject = null;
      }
      return moveOkay;
    }

    public void Reset() {
      currentIndex = -1;
      currentObject = null;
      if (collectionRef.Count != currentSize) {
        throw new global::System.InvalidOperationException("Collection modified.");
      }
    }

    public void Dispose() {
        currentIndex = -1;
        currentObject = null;
    }
  }

  public void Clear() {
    NanolibPINVOKE.OdIndexVector_Clear(swigCPtr);
  }

  public void Add( Nlc.OdIndex  x) {
    NanolibPINVOKE.OdIndexVector_Add(swigCPtr,  ref x );
  }

  private uint size() {
    uint ret = NanolibPINVOKE.OdIndexVector_size(swigCPtr);
    return ret;
  }

  private uint capacity() {
    uint ret = NanolibPINVOKE.OdIndexVector_capacity(swigCPtr);
    return ret;
  }

  private void reserve(uint n) {
    NanolibPINVOKE.OdIndexVector_reserve(swigCPtr, n);
  }

  public OdIndexVector() : this(NanolibPINVOKE.new_OdIndexVector__SWIG_0(), true) {
  }

  public OdIndexVector(OdIndexVector other) : this(NanolibPINVOKE.new_OdIndexVector__SWIG_1(OdIndexVector.getCPtr(other)), true) {
    if (NanolibPINVOKE.SWIGPendingException.Pending) throw NanolibPINVOKE.SWIGPendingException.Retrieve();
  }

  public OdIndexVector(int capacity) : this(NanolibPINVOKE.new_OdIndexVector__SWIG_2(capacity), true) {
    if (NanolibPINVOKE.SWIGPendingException.Pending) throw NanolibPINVOKE.SWIGPendingException.Retrieve();
  }

  private  Nlc.OdIndex  getitemcopy(int index) {
			Nlc.OdIndex ret = NanolibPINVOKE.OdIndexVector_getitemcopy(swigCPtr, index);
    if (NanolibPINVOKE.SWIGPendingException.Pending) throw NanolibPINVOKE.SWIGPendingException.Retrieve();
			return ret;
		}

  private  Nlc.OdIndex  getitem(int index) {
		global::System.IntPtr ptr = NanolibPINVOKE.OdIndexVector_getitem(swigCPtr, index);
    if (NanolibPINVOKE.SWIGPendingException.Pending) throw NanolibPINVOKE.SWIGPendingException.Retrieve();
		Nlc.OdIndex ret = (Nlc.OdIndex)global::System.Runtime.InteropServices.Marshal.PtrToStructure(ptr, typeof(Nlc.OdIndex));
		return ret;
	}

  private void setitem(int index,  Nlc.OdIndex  val) {
    NanolibPINVOKE.OdIndexVector_setitem(swigCPtr, index,  ref val );
    if (NanolibPINVOKE.SWIGPendingException.Pending) throw NanolibPINVOKE.SWIGPendingException.Retrieve();
  }

  public void AddRange(OdIndexVector values) {
    NanolibPINVOKE.OdIndexVector_AddRange(swigCPtr, OdIndexVector.getCPtr(values));
    if (NanolibPINVOKE.SWIGPendingException.Pending) throw NanolibPINVOKE.SWIGPendingException.Retrieve();
  }

  public OdIndexVector GetRange(int index, int count) {
    global::System.IntPtr cPtr = NanolibPINVOKE.OdIndexVector_GetRange(swigCPtr, index, count);
    OdIndexVector ret = (cPtr == global::System.IntPtr.Zero) ? null : new OdIndexVector(cPtr, true);
    if (NanolibPINVOKE.SWIGPendingException.Pending) throw NanolibPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public void Insert(int index,  Nlc.OdIndex  x) {
    NanolibPINVOKE.OdIndexVector_Insert(swigCPtr, index,  ref x );
    if (NanolibPINVOKE.SWIGPendingException.Pending) throw NanolibPINVOKE.SWIGPendingException.Retrieve();
  }

  public void InsertRange(int index, OdIndexVector values) {
    NanolibPINVOKE.OdIndexVector_InsertRange(swigCPtr, index, OdIndexVector.getCPtr(values));
    if (NanolibPINVOKE.SWIGPendingException.Pending) throw NanolibPINVOKE.SWIGPendingException.Retrieve();
  }

  public void RemoveAt(int index) {
    NanolibPINVOKE.OdIndexVector_RemoveAt(swigCPtr, index);
    if (NanolibPINVOKE.SWIGPendingException.Pending) throw NanolibPINVOKE.SWIGPendingException.Retrieve();
  }

  public void RemoveRange(int index, int count) {
    NanolibPINVOKE.OdIndexVector_RemoveRange(swigCPtr, index, count);
    if (NanolibPINVOKE.SWIGPendingException.Pending) throw NanolibPINVOKE.SWIGPendingException.Retrieve();
  }

  public static OdIndexVector Repeat( Nlc.OdIndex  value, int count) {
    global::System.IntPtr cPtr = NanolibPINVOKE.OdIndexVector_Repeat( ref value , count);
    OdIndexVector ret = (cPtr == global::System.IntPtr.Zero) ? null : new OdIndexVector(cPtr, true);
    if (NanolibPINVOKE.SWIGPendingException.Pending) throw NanolibPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public void Reverse() {
    NanolibPINVOKE.OdIndexVector_Reverse__SWIG_0(swigCPtr);
  }

  public void Reverse(int index, int count) {
    NanolibPINVOKE.OdIndexVector_Reverse__SWIG_1(swigCPtr, index, count);
    if (NanolibPINVOKE.SWIGPendingException.Pending) throw NanolibPINVOKE.SWIGPendingException.Retrieve();
  }

  public void SetRange(int index, OdIndexVector values) {
    NanolibPINVOKE.OdIndexVector_SetRange(swigCPtr, index, OdIndexVector.getCPtr(values));
    if (NanolibPINVOKE.SWIGPendingException.Pending) throw NanolibPINVOKE.SWIGPendingException.Retrieve();
  }

}

}
