Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #if !defined (octave_Array3_h)
00025 #define octave_Array3_h 1
00026
00027 #include <cassert>
00028 #include <cstdlib>
00029
00030 #include "Array.h"
00031 #include "lo-error.h"
00032
00033 class idx_vector;
00034
00035
00036
00037 template <class T>
00038 class
00039 Array3 : public Array<T>
00040 {
00041 public:
00042
00043 Array3 (void) : Array<T> (dim_vector (0, 0, 0)) { }
00044
00045 Array3 (octave_idx_type r, octave_idx_type c, octave_idx_type p) : Array<T> (dim_vector (r, c, p)) { }
00046
00047 Array3 (octave_idx_type r, octave_idx_type c, octave_idx_type p, const T& val)
00048 : Array<T> (dim_vector (r, c, p), val) { }
00049
00050 Array3 (const Array3<T>& a)
00051 : Array<T> (a, a.dims ()) { }
00052
00053 Array3 (const Array<T>& a, octave_idx_type r, octave_idx_type c, octave_idx_type p)
00054 : Array<T> (a, dim_vector (r, c, p)) { }
00055
00056 ~Array3 (void) { }
00057
00058 Array3<T>& operator = (const Array3<T>& a)
00059 {
00060 if (this != &a)
00061 Array<T>::operator = (a);
00062
00063 return *this;
00064 }
00065
00066 void resize (octave_idx_type r, octave_idx_type c, octave_idx_type p)
00067 { Array<T>::resize (dim_vector (r, c, p)); }
00068
00069 void resize (octave_idx_type r, octave_idx_type c, octave_idx_type p, const T& val)
00070 { Array<T>::resize (dim_vector (r, c, p), val); }
00071
00072 Array3<T> sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
00073 {
00074 Array<T> tmp = Array<T>::sort (dim, mode);
00075 return Array3<T> (tmp, tmp.rows (), tmp.columns (), tmp.pages ());
00076 }
00077
00078 Array3<T> sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
00079 sortmode mode = ASCENDING) const
00080 {
00081 Array<T> tmp = Array<T>::sort (sidx, dim, mode);
00082 return Array3<T> (tmp, tmp.rows (), tmp.columns (), tmp.pages ());
00083 }
00084 };
00085
00086
00087 #ifdef __GNUC__
00088 #warning Using Array3<T> is deprecated. Use Array<T> directly.
00089 #endif
00090
00091 #endif