Debian Codegraph @

tools/swig/test/ArrayZ.h

raw
1 #ifndef ARRAYZ_H
2 #define ARRAYZ_H
3
4 #include <stdexcept>
5 #include <string>
6 #include <complex>
7
8 class ArrayZ
9 {
10 public:
11
12 // Default/length/array constructor
13 ArrayZ(int length = 0, std::complex<double>* data = 0);
14
15 // Copy constructor
16 ArrayZ(const ArrayZ & source);
17
18 // Destructor
19 ~ArrayZ();
20
21 // Assignment operator
22 ArrayZ & operator=(const ArrayZ & source);
23
24 // Equals operator
25 bool operator==(const ArrayZ & other) const;
26
27 // Length accessor
28 int length() const;
29
30 // Resize array
31 void resize(int length, std::complex<double>* data = 0);
32
33 // Set item accessor
34 std::complex<double> & operator[](int i);
35
36 // Get item accessor
37 const std::complex<double> & operator[](int i) const;
38
39 // String output
40 std::string asString() const;
41
42 // Get view
43 void view(std::complex<double>** data, int* length) const;
44
45 private:
46 // Members
47 bool _ownData;
48 int _length;
49 std::complex<double> * _buffer;
50
51 // Methods
52 void allocateMemory();
53 void deallocateMemory();
54 };
55
56 #endif