00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef SELDON_FILE_VECTOR_VECTOR2_HXX
00022
00023
00024 #ifndef SELDON_VECTOR2_DEFAULT_ALLOCATOR_0
00025
00028 #define SELDON_VECTOR2_DEFAULT_ALLOCATOR_0 SELDON_DEFAULT_ALLOCATOR
00029 #endif
00030
00031 #ifndef SELDON_VECTOR2_DEFAULT_ALLOCATOR_1
00032
00035 #define SELDON_VECTOR2_DEFAULT_ALLOCATOR_1 MallocObject
00036 #endif
00037
00038
00039 namespace Seldon
00040 {
00041
00042
00044
00055 template <class T,
00056 class Allocator0 = SELDON_VECTOR2_DEFAULT_ALLOCATOR_0<T>,
00057 class Allocator1 = SELDON_VECTOR2_DEFAULT_ALLOCATOR_1<
00058 Vector<T, VectFull, Allocator0> > >
00059 class Vector2
00060 {
00061 public:
00062 typedef T value_type;
00063 typedef T* pointer;
00064 typedef const T* const_pointer;
00065 typedef T& reference;
00066 typedef const T& const_reference;
00067
00068 protected:
00069 Vector<Vector<T, VectFull, Allocator0>, VectFull, Allocator1> data_;
00070
00071 public:
00072
00073
00074
00075 Vector2();
00076 Vector2(int length);
00077 Vector2(const Vector<int>& length);
00078 ~Vector2();
00079
00080
00081
00082 bool IsEmpty() const;
00083 int GetLength() const;
00084 int GetSize() const;
00085 int GetLength(int i) const;
00086 int GetSize(int i) const;
00087 int GetNelement() const;
00088 int GetNelement(int beg, int end) const;
00089 Vector<int> GetShape() const;
00090 void GetShape(Vector<int>& shape) const;
00091 void Reallocate(int M);
00092 void Reallocate(int i, int N);
00093 void Reallocate(const Vector<int>& length);
00094 void Select(int beg, int end);
00095 template <class Td, class Allocatord>
00096 void Flatten(Vector<Td, VectFull, Allocatord>& data) const;
00097 template <class Td, class Allocatord>
00098 void Flatten(int beg, int end, Vector<Td, VectFull, Allocatord>& data)
00099 const;
00100
00101 void PushBack(int i, const T& x);
00102 void PushBack(const Vector<T, VectFull, Allocator0>& X);
00103 void PushBack(const Vector<Vector<T, VectFull, Allocator0>,
00104 VectFull, Allocator1>& V);
00105 void PushBack(const Vector2<T, Allocator0, Allocator1>& V);
00106
00107 void Clear();
00108 void Clear(int i);
00109
00110 void Fill(const T& x);
00111
00112 Vector<Vector<T, VectFull, Allocator0>, VectFull, Allocator1>&
00113 GetVector();
00114 const Vector<Vector<T, VectFull, Allocator0>, VectFull,
00115 Allocator1> GetVector() const;
00116
00117 Vector<T, VectFull, Allocator0>& GetVector(int i);
00118 const Vector<T, VectFull, Allocator0>& GetVector(int i) const;
00119
00120 void Copy(const Vector2<T, Allocator0, Allocator1>& V);
00121
00122
00123
00124 const Vector<T, VectFull, Allocator0>& operator() (int i) const;
00125 Vector<T, VectFull, Allocator0>& operator() (int i);
00126 const_reference operator() (int i, int j) const;
00127 reference operator() (int i, int j);
00128
00129
00130
00131 template <class V2>
00132 bool HasSameShape(const V2& V) const;
00133 void Print() const;
00134 };
00135
00136
00137 }
00138
00139
00140 #define SELDON_FILE_VECTOR_VECTOR2_HXX
00141 #endif