C++ main module for emicrom 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_ArrayList.h"
5 
13 template < class T>
14 class CORE_Array3D : public CORE_ArrayList<T> {
15 
16 private:
17 
18 
20 
21  // CONSTRUCTORS
22 public:
25  CORE_Array3D();
26 
27 
28  // DESTRUCTORS
31  virtual ~CORE_Array3D();
32 
33 
34 
35 public:
36  // OPERATOR
37 
40  const T& operator[](const tUIndex& index) const {
41  return &CORE_ArrayList<T>::operator[](index);
42  };
43 
47  T& operator[](const tUIndex& index) {
48  return &CORE_ArrayList<T>::operator[](index);
49  };
52  const T& operator()(const tUIndex& i,const tUIndex& j,const tUIndex& k) const {
53  return &CORE_ArrayList<T>::operator[](i+mSize[0]*(j+mSize[1]*k));
54  };
57  T& operator()(const tUIndex& i,const tUIndex& j,const tUIndex& k) {
58  return &CORE_ArrayList<T>::operator[](i+mSize[0]*(j+mSize[1]*k));
59  };
60 
61 
62 
65  static inline boost::shared_ptr<CORE_Array3D<T> > New() {
66  boost::shared_ptr<CORE_Array3D<T> > p(new CORE_Array3D<T>(),
68 
69  return p;
70  };
71 
72  // set METHODS
73 
74 
75 
78  void setSize(const tUIndex& n,const tUIndex& p,const tUIndex& q);
79 
80 
83  void copy(const CORE_Array3D<T>& src);
86  inline void copy(const CORE_Array3D<T>* src){
87  if (src!=null) copy(*src);
88  else clear();
89  };
90 
91 
92 
95  inline void set(const tUIndex& i,const tUIndex& j,const tUIndex& k,const T& obj) {
96  (*this)(i,j,k)=obj;
97  };
98 
99 
100 
101 
104  virtual void clear(){
105  setSize(0,0,0);
106  };
107 
108  // get METHODS
109 
115  inline void getSize(tUIndex& n,tUIndex& p,tUIndex& q) const {
116  n=mSize[0];
117  p=mSize[1];
118  q=mSize[2];
119  };
123  inline const tUIndex* getSize() const {
124  return mSize;
125  };
126 
127 
128 
129 
130  // other METHODS
131 
132 
135  tString toString() const;
136 
137 
138 };
139 
140 #include "CORE_Array3D.hpp"
141 
153 
154 
166 
167 #endif
T & operator[](const tUIndex &index)
get the k-the element (i,j,k)=[i+Nx*(j+Ny*k)] index : index of element
Definition: CORE_Array3D.h:47
virtual void clear()
clear the array
Definition: CORE_Array3D.h:104
this class describes an array of arrays stored as follow:
Definition: CORE_Array3D.h:14
static boost::shared_ptr< CORE_Array3D< T > > New()
New constructor. return a shared pointer of CORE_Array3D.
Definition: CORE_Array3D.h:65
void copy(const CORE_Array3D< T > &src)
void copy
Definition: CORE_Array3D.hpp:26
CORE_Array3D< tComplex > CORE_ComplexArray3D
Definition: CORE_Array3D.h:147
CORE_Array3D< tInteger > CORE_IntegerArray3D
Definition: CORE_Array3D.h:151
CORE_Array3D< tReal > CORE_RealArray3D
Definition: CORE_Array3D.h:146
const T & operator()(const tUIndex &i, const tUIndex &j, const tUIndex &k) const
get the index-th element (i,j,k)=[i+Nx*(j+Ny*k)]
Definition: CORE_Array3D.h:52
#define null
Definition: types.h:144
tString toString() const
turn the array into string
Definition: CORE_Array3D.hpp:32
const T & operator[](const tUIndex &i) const
get the i-th element Assert in (i>-1) Assert in (i<size());
Definition: CORE_Array.h:164
CORE_Array3D< tFlag > CORE_FlagArray3D
Definition: CORE_Array3D.h:148
CORE_Array3D()
build an array of T*
Definition: CORE_Array3D.hpp:9
CORE_Array3D< tBoolean > CORE_BooleanArray3D
Definition: CORE_Array3D.h:145
#define tUIndex
Definition: types.h:126
T & operator()(const tUIndex &i, const tUIndex &j, const tUIndex &k)
get the index-th element (i,j,k)=[i+Nx*(j+Ny*k)]
Definition: CORE_Array3D.h:57
CORE_Array3D< tChar > CORE_CharArray3D
Definition: CORE_Array3D.h:143
CORE_Array3D< tSInt > CORE_SIntArray3D
Definition: CORE_Array3D.h:149
#define tString
Definition: types.h:135
void setSize(const tUIndex &n, const tUIndex &p, const tUIndex &q)
set the size of the array
Definition: CORE_Array3D.hpp:18
CORE_Array3D< tUInteger > CORE_UIntegerArray3D
Definition: CORE_Array3D.h:152
void copy(const CORE_Array3D< T > *src)
void copy
Definition: CORE_Array3D.h:86
tUIndex mSize[3]
Definition: CORE_Array3D.h:19
CORE_Array3D< tString > CORE_StringArray3D
Definition: CORE_Array3D.h:150
Definition: CORE_ArrayList.h:12
const T & operator[](const tUIndex &index) const
get the index-th element (i,j,k)=
Definition: CORE_Array3D.h:40
void getSize(tUIndex &n, tUIndex &p, tUIndex &q) const
return the size of the array in each direction
Definition: CORE_Array3D.h:115
const tUIndex * getSize() const
return the sizes of the array in each direction
Definition: CORE_Array3D.h:123
TYPEDEF_SPTR(CORE_DoubleArray3D)
CORE_Array3D< tInt > CORE_IntArray3D
Definition: CORE_Array3D.h:144
CORE_Array3D< double > CORE_DoubleArray3D
Definition: CORE_Array3D.h:142
virtual ~CORE_Array3D()
destroy an array of T*
Definition: CORE_Array3D.hpp:14
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:141