~ubuntu-branches/ubuntu/vivid/quantlib-swig/vivid

« back to all changes in this revision

Viewing changes to CSharp/csharp/DateVector.cs

  • Committer: Bazaar Package Importer
  • Author(s): Dirk Eddelbuettel
  • Date: 2009-12-03 17:01:53 UTC
  • mfrom: (1.1.9 upstream) (2.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20091203170153-x5yrwybjsl2q11vw
* New upstream release

* debian/control: Updated Standards-Version: to current value

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* ----------------------------------------------------------------------------
2
2
 * This file was automatically generated by SWIG (http://www.swig.org).
3
 
 * Version 1.3.36
 
3
 * Version 1.3.40
4
4
 *
5
5
 * Do not make changes to this file unless you know what you are doing--modify
6
6
 * the SWIG interface file instead.
11
11
using System;
12
12
using System.Runtime.InteropServices;
13
13
 
14
 
public class DateVector : IDisposable, System.Collections.IEnumerable {
 
14
public class DateVector : IDisposable, System.Collections.IEnumerable
 
15
#if !SWIG_DOTNET_1
 
16
    , System.Collections.Generic.IEnumerable<Date>
 
17
#endif
 
18
 {
15
19
  private HandleRef swigCPtr;
16
20
  protected bool swigCMemOwn;
17
21
 
30
34
 
31
35
  public virtual void Dispose() {
32
36
    lock(this) {
33
 
      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
34
 
        swigCMemOwn = false;
35
 
        NQuantLibcPINVOKE.delete_DateVector(swigCPtr);
 
37
      if (swigCPtr.Handle != IntPtr.Zero) {
 
38
        if (swigCMemOwn) {
 
39
          swigCMemOwn = false;
 
40
          NQuantLibcPINVOKE.delete_DateVector(swigCPtr);
 
41
        }
 
42
        swigCPtr = new HandleRef(null, IntPtr.Zero);
36
43
      }
37
 
      swigCPtr = new HandleRef(null, IntPtr.Zero);
38
44
      GC.SuppressFinalize(this);
39
45
    }
40
46
  }
91
97
    }
92
98
  }
93
99
 
94
 
  public void CopyTo(System.Array array) {
 
100
#if SWIG_DOTNET_1
 
101
  public void CopyTo(System.Array array)
 
102
#else
 
103
  public void CopyTo(Date[] array)
 
104
#endif
 
105
  {
95
106
    CopyTo(0, array, 0, this.Count);
96
107
  }
97
108
 
98
 
  public void CopyTo(System.Array array, int arrayIndex) {
 
109
#if SWIG_DOTNET_1
 
110
  public void CopyTo(System.Array array, int arrayIndex)
 
111
#else
 
112
  public void CopyTo(Date[] array, int arrayIndex)
 
113
#endif
 
114
  {
99
115
    CopyTo(0, array, arrayIndex, this.Count);
100
116
  }
101
117
 
102
 
  public void CopyTo(int index, System.Array array, int arrayIndex, int count) {
 
118
#if SWIG_DOTNET_1
 
119
  public void CopyTo(int index, System.Array array, int arrayIndex, int count)
 
120
#else
 
121
  public void CopyTo(int index, Date[] array, int arrayIndex, int count)
 
122
#endif
 
123
  {
103
124
    if (array == null)
104
125
      throw new ArgumentNullException("array");
105
126
    if (index < 0)
109
130
    if (count < 0)
110
131
      throw new ArgumentOutOfRangeException("count", "Value is less than zero");
111
132
    if (array.Rank > 1)
112
 
      throw new ArgumentException("Multi dimensional array.");
 
133
      throw new ArgumentException("Multi dimensional array.", "array");
113
134
    if (index+count > this.Count || arrayIndex+count > array.Length)
114
135
      throw new ArgumentException("Number of elements to copy is too large.");
115
136
    for (int i=0; i<count; i++)
116
137
      array.SetValue(getitemcopy(index+i), arrayIndex+i);
117
138
  }
118
139
 
119
 
  // Type-safe version of IEnumerable.GetEnumerator
 
140
#if !SWIG_DOTNET_1
 
141
  System.Collections.Generic.IEnumerator<Date> System.Collections.Generic.IEnumerable<Date>.GetEnumerator() {
 
142
    return new DateVectorEnumerator(this);
 
143
  }
 
144
#endif
 
145
 
120
146
  System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
121
147
    return new DateVectorEnumerator(this);
122
148
  }
130
156
  /// whenever the collection is modified. This has been done for changes in the size of the
131
157
  /// collection but not when one of the elements of the collection is modified as it is a bit
132
158
  /// tricky to detect unmanaged code that modifies the collection under our feet.
133
 
  public sealed class DateVectorEnumerator : System.Collections.IEnumerator {
 
159
  public sealed class DateVectorEnumerator : System.Collections.IEnumerator
 
160
#if !SWIG_DOTNET_1
 
161
    , System.Collections.Generic.IEnumerator<Date>
 
162
#endif
 
163
  {
134
164
    private DateVector collectionRef;
135
165
    private int currentIndex;
136
166
    private object currentObject;
182
212
        throw new InvalidOperationException("Collection modified.");
183
213
      }
184
214
    }
 
215
 
 
216
#if !SWIG_DOTNET_1
 
217
    public void Dispose() {
 
218
        currentIndex = -1;
 
219
        currentObject = null;
 
220
    }
 
221
#endif
185
222
  }
186
223
 
187
224
  public void Clear() {
215
252
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
216
253
  }
217
254
 
218
 
  public DateVector(int capacity) : this(NQuantLibcPINVOKE.new_DateVector__SWIG_1(capacity), true) {
 
255
  public DateVector(DateVector other) : this(NQuantLibcPINVOKE.new_DateVector__SWIG_1(DateVector.getCPtr(other)), true) {
 
256
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 
257
  }
 
258
 
 
259
  public DateVector(int capacity) : this(NQuantLibcPINVOKE.new_DateVector__SWIG_2(capacity), true) {
219
260
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
220
261
  }
221
262