00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef GLIFT_ARRAY_5_OWN_H_
00029 #define GLIFT_ARRAY_5_OWN_H_
00030
00031 #include "arrayWrap5.h"
00032 #include <assert.h>
00033
00034 namespace gutz {
00035
00036
00037
00038
00039
00040 template <class T>
00041 class arrayOwn5 : public arrayWrap5<T>
00042 {
00043 public:
00044
00045 arrayOwn5 ();
00046 arrayOwn5 (int d0, int d1, int d2, int d3, int d4, T v );
00047 arrayOwn5 (int d0, int d1, int d2, int d3, int d4, const T* v);
00048 arrayOwn5 ( const arrayWrap5<T>& a );
00049
00050
00051 arrayOwn5 (const arrayOwn5<T>& a);
00052 arrayOwn5<T>& operator= (const arrayOwn5<T>& a);
00053 ~arrayOwn5() {killData();}
00054
00055
00056
00057
00058 void transfer( int d0, int d1, int d3, int d4, int d5, T* v, bool killWithDelete );
00059
00060 private:
00061 void initVal (T v);
00062 void initData (const T* d);
00063 void copy (const arrayOwn5<T>& a);
00064 };
00065
00066
00067
00068
00069
00070
00071 template <class T>
00072 arrayOwn5<T>::arrayOwn5()
00073 : arrayWrap5<T>()
00074 {}
00075
00076 template <class T>
00077 arrayOwn5<T>::arrayOwn5 (int d0, int d1, int d2, int d3, int d4, T val)
00078 : arrayWrap5<T>(d0, d1, d2, d3, d4, NULL)
00079 {
00080 arrayBase<T>::initValOwn( val );
00081 }
00082
00083 template <class T>
00084 arrayOwn5<T>::arrayOwn5 (int d0, int d1, int d2, int d3, int d4, const T* data)
00085 : arrayWrap5<T>(d0, d1, d2, d3, d4, NULL)
00086 {
00087 arrayBase<T>::initDataOwn( data );
00088 }
00089
00090 template <class T>
00091 arrayOwn5<T>::arrayOwn5 ( const arrayWrap5<T>& a ) : arrayWrap5<T>(a)
00092 {
00093 arrayBase<T>::initDataOwn( a.data() );
00094 }
00095
00096
00097 template <class T>
00098 arrayOwn5<T>::arrayOwn5 (const arrayOwn5<T>& a) : arrayWrap5<T>(a)
00099
00100 {
00101 arrayBase<T>::initDataOwn(a.mData);
00102 }
00103
00104
00105 template <class T>
00106 arrayOwn5<T>& arrayOwn5<T>::operator= (const arrayOwn5<T>& a)
00107 {
00108 if( &a != this ) {
00109 if( (mSize != a.size() ) ||
00110 (dim(0) != a.dim(0)) ||
00111 (dim(1) != a.dim(1)) ||
00112 (dim(2) != a.dim(2)) ||
00113 (dim(3) != a.dim(3)) ||
00114 (dim(4) != a.dim(4)) ) {
00115 killData();
00116 arrayWrap5<T>::operator=(a);
00117 arrayBase<T>::allocDataOwn();
00118 }
00119 arrayBase<T>::copyDataOwn(a.mData);
00120 }
00121 return *this;
00122 }
00123
00124
00125
00126 template <class T>
00127 void arrayOwn5<T>::transfer( int d0, int d1, int d2, int d3, int d4, T* v, bool killWithDelete )
00128 {
00129 killData();
00130
00131 int sizes[5];
00132 sizes[0] = d0;
00133 sizes[1] = d1;
00134 sizes[2] = d2;
00135 sizes[3] = d3;
00136 sizes[4] = d4;
00137
00138 set(5, sizes, v);
00139 mSlice = arrayWrap4<T>(d1,d2,d3,d4,v);
00140 mKillWithDelete = killWithDelete;
00141 }
00142
00143
00144
00145
00146
00147 typedef arrayOwn5<char> arrayo5c;
00148 typedef arrayOwn5<uchar> arrayo5uc;
00149 typedef arrayOwn5<char> arrayo5b;
00150 typedef arrayOwn5<uchar> arrayo5ub;
00151 typedef arrayOwn5<short> arrayo5s;
00152 typedef arrayOwn5<ushort> arrayo5us;
00153 typedef arrayOwn5<int> arrayo5i;
00154 typedef arrayOwn5<uint> arrayo5ui;
00155 typedef arrayOwn5<long> arrayo5l;
00156 typedef arrayOwn5<ulong> arrayo5ul;
00157 typedef arrayOwn5<llong> arrayo5ll;
00158 typedef arrayOwn5<ullong> arrayo5ull;
00159 typedef arrayOwn5<float> arrayo5f;
00160 typedef arrayOwn5<double> arrayo5d;
00161
00162 #ifdef USING_MATHGUTZ
00163 typedef arrayOwn5<vec2ub> arrayo5v2ub;
00164 typedef arrayOwn5<vec2i> arrayo5v2i;
00165 typedef arrayOwn5<vec2ui> arrayo5v2ui;
00166 typedef arrayOwn5<vec2f> arrayo5v2f;
00167
00168 typedef arrayOwn5<vec3ub> arrayo5v3ub;
00169 typedef arrayOwn5<vec3i> arrayo5v3i;
00170 typedef arrayOwn5<vec3ui> arrayo5v3ui;
00171 typedef arrayOwn5<vec3f> arrayo5v3f;
00172
00173 typedef arrayOwn5<vec4ub> arrayo5v4ub;
00174 typedef arrayOwn5<vec4i> arrayo5v4i;
00175 typedef arrayOwn5<vec4ui> arrayo5v4ui;
00176 typedef arrayOwn5<vec4f> arrayo5v4f;
00177
00178 typedef arrayOwn5<mat2ub> arrayo5m2ub;
00179 typedef arrayOwn5<mat2i> arrayo5m2i;
00180 typedef arrayOwn5<mat2ui> arrayo5m2ui;
00181 typedef arrayOwn5<mat2f> arrayo5m2f;
00182
00183 typedef arrayOwn5<mat3ub> arrayo5m3ub;
00184 typedef arrayOwn5<mat3i> arrayo5m3i;
00185 typedef arrayOwn5<mat3ui> arrayo5m3ui;
00186 typedef arrayOwn5<mat3f> arrayo5m3f;
00187
00188 typedef arrayOwn5<mat4ub> arrayo5m4ub;
00189 typedef arrayOwn5<mat4i> arrayo5m4i;
00190 typedef arrayOwn5<mat4ui> arrayo5m4ui;
00191 typedef arrayOwn5<mat4f> arrayo5m4f;
00192 #endif
00193
00194 }
00195
00196 #endif // arrayOwn5_h