C++ main module for emicrom Package  1.0
EMM_Array.h
Go to the documentation of this file.
1 #ifndef EMM_Array_H
2 #define EMM_Array_H
3 
4 #include "CORE_Array.h"
5 #include "EMM_Types.h"
6 
7 
17 template<class T>
18 class EMM_Array : public CORE_Array<T> {
19 
20 
21  // ATTRIBUTES
22 
23 public:
24 
25 
26 
27 private:
28 
29 
30 public:
31  // METHODS
32 
33  // CONSTRUCTORS
34 
38 
39  }
44  }
48  EMM_Array(const tUIndex& n):CORE_Array<T>(n){
49  }
50 
51 
52 
53 
54  // DESTRUCTORS
55 
56 
59  virtual ~EMM_Array(void) {
60 
61  }
62 
63 
64 private:
65 
66 
67 
68 public:
69  // -------------------------
70  // shared pointer operator
71  // ------------------------
75  void getSharedPointer(boost::shared_ptr<EMM_Array<T> >& p){
76  SP::CORE_Object r;
78  p=boost::dynamic_pointer_cast<EMM_Array<T> >(r);
79  };
83  void getSharedPointer( boost::shared_ptr<const EMM_Array<T> >& p) const{
84  SPC::CORE_Object r;
86  p=boost::dynamic_pointer_cast<const EMM_Array<T> >(r);
87  };
88 private:
92  inline boost::shared_ptr<EMM_Array<T> > getThis() {
93  boost::shared_ptr<EMM_Array<T> > p;
95  return p;
96  };
100  inline boost::shared_ptr<const EMM_Array<T> > getThis() const {
101  boost::shared_ptr<const EMM_Array<T> > p;
102  getSharedPointer(p);
103  return p;
104  };
105 
106 public:
107  // ----------------
108  // New constructors
109  // ----------------
110 public:
114  static inline boost::shared_ptr<EMM_Array<T> > New() {
115  boost::shared_ptr<EMM_Array<T> > p(new EMM_Array<T>(),
117  p->setThis(p);
118  return p;
119  };
120 
121  // ACCESSOR
122 
123 
124  //arithmetic operator
125  // ==================
126 
131  template<class Q>
132  inline EMM_Array<T>& operator+=(const Q& f) {
134  return (*this);
135  }
136 
141  template<class Q>
142  inline EMM_Array<T>& operator-=(const Q& f) {
144  return (*this);
145  }
146 
151  template<class Q>
152  inline EMM_Array<T>& operator*=(const Q& f) {
154  return (*this);
155  }
160  template<class Q>
161  inline EMM_Array<T>& operator/=(const Q& f) {
163  return (*this);
164  }
165 
166  //copy operator
167  // ============
168 
172  template<class Q>
173  EMM_Array<T>& operator=(const EMM_Array<Q>& f) {
175  return *this;
176  }
177 
178 
179 
180 
181  // SET methods
182 
183 
184  // GET methods
185 
186 
187 public:
188  // OTHERS methods
189 
190 
191 
201  tBoolean saveToFile(const tString& fileName) const;
202 
203 
208  inline tBoolean saveToStream(ofstream& f) const {
209  return saveToStream(f,1);
210  }
211 
217  tBoolean saveToStream(ofstream& f,const tUSInt& dim) const;
218 
225  static tBoolean saveToStream(ofstream& f,const vector<tUSInt>& dims,const vector<const EMM_Array<T>*>& inds);
226 
237  tBoolean loadFromFile(const tString& fileName);
238 
245  tBoolean loadFromStream(ifstream& f,const vector<tUSInt>& dims,const vector<EMM_Array<T>* >& arrays) const;
246 
252  tBoolean loadFromStream(ifstream& f,const tUSInt& dim);
257  inline tBoolean loadFromStream(ifstream& f) {
258  return loadFromStream(f,1);
259  }
260 
261 
262 };
263 
264 #include "EMM_Array.hpp"
265 
280 
295 
310 #endif
EMM_Array< T > & operator+=(const Q &f)
This+=f.
Definition: EMM_Array.h:132
CORE_Array< T > & operator-=(const Q &f)
This-=f.
Definition: CORE_Array.h:222
EMM_Array< tSInt > EMM_SIntArray
Definition: EMM_Array.h:273
tBoolean loadFromStream(ifstream &f, const vector< tUSInt > &dims, const vector< EMM_Array< T > * > &arrays) const
load the values to indicators from the stream
Definition: EMM_Array.hpp:235
EMM_Array< tBoolean > EMM_BooleanArray
Definition: EMM_Array.h:277
EMM_Array(const EMM_Array< T > &c)
create an array with copy of c
Definition: EMM_Array.h:43
EMM_Array< tInt > EMM_IntArray
Definition: EMM_Array.h:274
EMM_Array< T > & operator*=(const Q &f)
This*=f.
Definition: EMM_Array.h:152
EMM_Array< tUSInt > EMM_USIntArray
Definition: EMM_Array.h:271
EMM_Array< tIndex > EMM_IndexArray
Definition: EMM_Array.h:270
TYPEDEF_SPTR(EMM_DoubleArray)
#define tUSInt
Definition: types.h:28
#define tBoolean
Definition: types.h:139
TYPEDEF_SVPTR(EMM_DoubleArray)
EMM_Array< tCellFlag > EMM_CellFlagArray
Definition: EMM_Array.h:278
EMM_Array< tUChar > EMM_UCharArray
Definition: EMM_Array.h:276
tBoolean loadFromFile(const tString &fileName)
load the steady array from file
Definition: EMM_Array.hpp:116
boost::shared_ptr< const EMM_Array< T > > getThis() const
return the shared pointer this for reading
Definition: EMM_Array.h:100
EMM_Array()
create an array
Definition: EMM_Array.h:37
tBoolean saveToStream(ofstream &f) const
save the values of the array into the stream with 1 value per line
Definition: EMM_Array.h:208
CORE_Array< T > & operator/=(const Q &f)
This/=f.
Definition: CORE_Array.h:253
void getSharedPointer(boost::shared_ptr< const EMM_Array< T > > &p) const
return the shared pointer corresponding to the class whith casting
Definition: EMM_Array.h:83
this class describes an array
Definition: CORE_Array.h:19
tBoolean saveToFile(const tString &fileName) const
save the steady array into file
Definition: EMM_Array.hpp:10
void getSharedPointer(SP::CORE_Object &p)
get the shared pointer of this class into p
Definition: CORE_Object.h:97
EMM_Array< tLimitCondition > EMM_LimitConditionArray
Definition: EMM_Array.h:279
#define tUIndex
Definition: types.h:126
EMM_Array< tUIndex > EMM_UIndexArray
Definition: EMM_Array.h:269
tBoolean loadFromStream(ifstream &f)
load the values of the array from the stream with one value per line
Definition: EMM_Array.h:257
EMM_Array(const tUIndex &n)
create an array of size n
Definition: EMM_Array.h:48
#define tString
Definition: types.h:135
EMM_Array< T > & operator/=(const Q &f)
This/=f.
Definition: EMM_Array.h:161
EMM_Array< double > EMM_DoubleArray
Definition: EMM_Array.h:266
EMM_Array< T > & operator=(const EMM_Array< Q > &f)
copy the array
Definition: EMM_Array.h:173
virtual ~EMM_Array(void)
destroy
Definition: EMM_Array.h:59
EMM_Array< float > EMM_FloatArray
Definition: EMM_Array.h:268
EMM_Array< T > & operator-=(const Q &f)
This+=f.
Definition: EMM_Array.h:142
CORE_Array< T > & operator+=(const Q &f)
This+=f.
Definition: CORE_Array.h:207
EMM_Array< tFlag > EMM_FlagArray
Definition: EMM_Array.h:275
EMM_Array< long double > EMM_LDoubleArray
Definition: EMM_Array.h:267
This class describes a general array.
Definition: EMM_Array.h:18
CORE_Array< T > & operator*=(const Q &f)
This*=f.
Definition: CORE_Array.h:237
boost::shared_ptr< EMM_Array< T > > getThis()
return the shared pointer this for writing
Definition: EMM_Array.h:92
static boost::shared_ptr< EMM_Array< T > > New()
create a new shared pointer of EMM_Array
Definition: EMM_Array.h:114
EMM_Array< tUInt > EMM_UIntArray
Definition: EMM_Array.h:272
void getSharedPointer(boost::shared_ptr< EMM_Array< T > > &p)
return the shared pointer corresponding to the class with casting d*
Definition: EMM_Array.h:75
void copy(const CORE_Array< Q > &f)
copy the array
Definition: CORE_Array.hpp:16
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:141