summaryrefslogtreecommitdiff
path: root/tools/swig/test/Array1.h
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2014-03-12 11:19:40 -0600
committerCharles Harris <charlesr.harris@gmail.com>2014-03-12 11:26:48 -0600
commita38888c18cd2a20de0eb0578b3fa8660cda79582 (patch)
tree4f0590684328a013544de84b1577f9322db4cbac /tools/swig/test/Array1.h
parent4fd4850d6b8bb9a8837e19b7ef2b38d0cd67fdd1 (diff)
downloadnumpy-a38888c18cd2a20de0eb0578b3fa8660cda79582.tar.gz
MAINT: Move doc/swig to tools/swig.
Also update MANIFEST.in and documentation to reflect the move. The discussion of this change is at #2384. Closes #2384. Closes #4374.
Diffstat (limited to 'tools/swig/test/Array1.h')
-rw-r--r--tools/swig/test/Array1.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/tools/swig/test/Array1.h b/tools/swig/test/Array1.h
new file mode 100644
index 000000000..754c248fc
--- /dev/null
+++ b/tools/swig/test/Array1.h
@@ -0,0 +1,55 @@
+#ifndef ARRAY1_H
+#define ARRAY1_H
+
+#include <stdexcept>
+#include <string>
+
+class Array1
+{
+public:
+
+ // Default/length/array constructor
+ Array1(int length = 0, long* data = 0);
+
+ // Copy constructor
+ Array1(const Array1 & source);
+
+ // Destructor
+ ~Array1();
+
+ // Assignment operator
+ Array1 & operator=(const Array1 & source);
+
+ // Equals operator
+ bool operator==(const Array1 & other) const;
+
+ // Length accessor
+ int length() const;
+
+ // Resize array
+ void resize(int length, long* data = 0);
+
+ // Set item accessor
+ long & operator[](int i);
+
+ // Get item accessor
+ const long & operator[](int i) const;
+
+ // String output
+ std::string asString() const;
+
+ // Get view
+ void view(long** data, int* length) const;
+
+private:
+ // Members
+ bool _ownData;
+ int _length;
+ long * _buffer;
+
+ // Methods
+ void allocateMemory();
+ void deallocateMemory();
+};
+
+#endif