C++ main module for gpm Package  1.0
CORE_Array3D.h
Go to the documentation of this file.
1 #ifndef CORE_Array3D_H
2 #define CORE_Array3D_H
3 
4 #include "CORE_List.h"
5 #include "CORE_Array.h"
6 #include "CORE_Vector.h"
7 
12 template < class T>
13 class CORE_Array3D : public CORE_List {
14 
15  private:
16 
17  T ***mVector;
18  int mN1;
19  int mN2;
20  int mN3;
21 
22  // CONSTRUCTORS
23  public:
26  CORE_Array3D();
27 
28 
29  // DESTRUCTORS
32  virtual ~CORE_Array3D();
33 
34 
35 
36  public:
37  // OPERATOR
38 
43  const T** operator[](const int& i) const {
44  ASSERT_IN(i>-1);
45  ASSERT_IN(i<mN1);
46  return mVector[i];
47  };
48 
53  T** operator[](const int& i) {
54  ASSERT_IN(i>-1);
55  ASSERT_IN(i<mN1);
56  return mVector[i];
57  };
58 
61  static inline boost::shared_ptr<CORE_Array3D<T> > New() {
62  boost::shared_ptr<CORE_Array3D<T> > p(new CORE_Array3D<T>(),
64 
65  return p;
66  };
67 
68  // set METHODS
69 
70 
71 
74  void setSize(const int& n,const int& p,const int& q);
75 
76 
79  void copy(const CORE_Array3D<T>& src);
82  inline void copy(const CORE_Array3D<T>* src){
83  if (src!=null) copy(*src);
84  else clear();
85  };
86 
87 
88 
91  inline void set(const int& i,const int& j,const int& k,const T& obj) {
92  ASSERT_IN(i>-1);
93  ASSERT_IN(i<mN1);
94  ASSERT_IN(j>-1);
95  ASSERT_IN(j<mN2);
96  ASSERT_IN(k>-1);
97  ASSERT_IN(k<mN3);
98  mVector[i][j][k]=obj;
99  };
100 
101 
102 
103 
106  virtual void clear(){
107  setSize(0,0,0);
108  };
109 
110  // get METHODS
111 
113  inline void size(int& n,int& p,int& q) const {
114  n=mN1;
115  p=mN2;
116  q=mN3;
117  };
118 
120  inline void getSize(int& n,int& p,int& q) const {
121  size(n,p,q);
122  };
123 
124 
125 
126 
127  // other METHODS
128 
129 
132  tString toString() const;
133 
134 
135 };
136 
137 #include "CORE_Array3D.hpp"
138 
150 
151 
163 
164 #endif
void size(int &n, int &p, int &q) const
return the size of the array
Definition: CORE_Array3D.h:113
tString toString() const
turn the array into string
Definition: CORE_Array3D.hpp:64
void getSize(int &n, int &p, int &q) const
return the size of the array
Definition: CORE_Array3D.h:120
virtual void clear()
clear the array
Definition: CORE_Array3D.h:106
this class describes an array of arrays
Definition: CORE_Array3D.h:13
CORE_Array3D< tRelativeInteger > CORE_RelativeIntegerArray3D
Definition: CORE_Array3D.h:149
static boost::shared_ptr< CORE_Array3D< T > > New()
New constructor. return a shared pointer of CORE_Array3D.
Definition: CORE_Array3D.h:61
this class describes a list
Definition: CORE_List.h:12
void setSize(const int &n, const int &p, const int &q)
set the size of the array
Definition: CORE_Array3D.hpp:27
void copy(const CORE_Array3D< T > &src)
void copy
Definition: CORE_Array3D.hpp:48
CORE_Array3D< tComplex > CORE_ComplexArray3D
Definition: CORE_Array3D.h:144
CORE_Array3D< tInteger > CORE_IntegerArray3D
Definition: CORE_Array3D.h:148
CORE_Array3D< tShort > CORE_ShortArray3D
Definition: CORE_Array3D.h:146
CORE_Array3D< tReal > CORE_RealArray3D
Definition: CORE_Array3D.h:143
CORE_Array3D< tCharacter > CORE_CharacterArray3D
Definition: CORE_Array3D.h:140
const T ** operator[](const int &i) const
get the i-th element Assert in (i>-1) Assert in (i
Definition: CORE_Array3D.h:43
#define null
Definition: types.h:13
void set(const int &i, const int &j, const int &k, const T &obj)
set the object at the index i
Definition: CORE_Array3D.h:91
CORE_Array3D< tFlag > CORE_FlagArray3D
Definition: CORE_Array3D.h:145
CORE_Array3D()
build an array of T*
Definition: CORE_Array3D.hpp:9
CORE_Array3D< tBoolean > CORE_BooleanArray3D
Definition: CORE_Array3D.h:142
CORE_Array3D< int > CORE_IntArray3D
Definition: CORE_Array3D.h:141
#define tString
Definition: types.h:36
T ** operator[](const int &i)
get the i-th element Assert in (i>-1) Assert in (i
Definition: CORE_Array3D.h:53
void copy(const CORE_Array3D< T > *src)
void copy
Definition: CORE_Array3D.h:82
CORE_Array3D< tString > CORE_StringArray3D
Definition: CORE_Array3D.h:147
TYPEDEF_SPTR(CORE_DoubleArray3D)
CORE_Array3D< double > CORE_DoubleArray3D
Definition: CORE_Array3D.h:139
#define ASSERT_IN(a)
Definition: types.h:82
virtual ~CORE_Array3D()
destroy an array of T*
Definition: CORE_Array3D.hpp:17
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106