C++ main module for emicrom Package  1.0
CORE_MorseArrayIterator.h
Go to the documentation of this file.
1 #ifndef CORE_MorseArrayIterator_H
2 #define CORE_MorseArrayIterator_H
3 
4 #include "CORE_Object.h"
5 
6 
14 template<class T>
16 
17 
18  // ATTRIBUTES
19 
20 public:
21 
22 
23 
24 private:
25 
26  //pointer values
27  T *mValues;
28  //index of the values
30  //size between two index
32 
33  //index increment in {0,1}
35 
36 public:
37  // METHODS
38 
39  // CONSTRUCTORS
40 
44  mValues=null;
45  mIndex=null;
46  mSize=0;
47  mIncrement=0;
48  }
49 
50 
51 
52  // DESTRUCTORS
53 
54 
57  virtual ~CORE_MorseArrayIterator(void) {
58 
59  }
60 
61 public:
62 
63  //operator
64 
65 
66  // ACCESSORS
67  //==========
68 
69 
70 
71 
72 public:
73 
74 
75 public:
81  inline void init(T* values,
82  tUIndex* index,
83  const tBoolean& inc) {
84  //1st value at index
85  mValues=values;
86  //ponter to index array
87  mIndex=index;
88  //size of the values
89  mSize=(*(mIndex+1))-(*mIndex);
90  //index increment
91  mIncrement=inc;
92  }
93 
94 
95 
99  //index of next element
100  mIndex+=mIncrement;
101  //values of next element (mIncrement=0|1)
102  mValues+=mSize*mIncrement;
103  //size of next element
104  mSize=(*(mIndex+1))-(*mIndex);
105  return (*this);
106  }
107 
112  inline tBoolean operator!=(const CORE_MorseArrayIterator<T>& iter) const {
113  return (mIndex!=&iter.index());
114  }
115 
120  inline tBoolean operator==(const CORE_MorseArrayIterator<T>& iter) const {
121  return (mIndex==&iter.index());
122  }
123 
124 
125 
129  inline T* values() const {
130  return mValues;
131  }
135  inline tUIndex& index() const {
136  return *mIndex;
137  }
141  inline const tUIndex& size() const {
142  return mSize;
143  }
147  inline const tBoolean& increment() const {
148  return increment;
149  }
153  inline void setSize(const tUIndex& n) {
154  (*(mIndex+1))=(*mIndex)+n;
155  mSize=n;
156 
157  }
158 
159 
160 
161 
162 };
163 
164 #endif
void init(T *values, tUIndex *index, const tBoolean &inc)
init the iterator to pointers
Definition: CORE_MorseArrayIterator.h:81
tBoolean operator!=(const CORE_MorseArrayIterator< T > &iter) const
test if two iterator are not equal
Definition: CORE_MorseArrayIterator.h:112
tBoolean mIncrement
Definition: CORE_MorseArrayIterator.h:34
tUIndex & index() const
return the current index
Definition: CORE_MorseArrayIterator.h:135
virtual ~CORE_MorseArrayIterator(void)
destroy
Definition: CORE_MorseArrayIterator.h:57
#define tBoolean
Definition: types.h:139
CORE_MorseArrayIterator()
create an iterator to empty
Definition: CORE_MorseArrayIterator.h:43
CORE_MorseArrayIterator< T > & operator++()
increment the iterator: get the values of next element
Definition: CORE_MorseArrayIterator.h:98
#define null
Definition: types.h:144
void setSize(const tUIndex &n)
set the size of the element
Definition: CORE_MorseArrayIterator.h:153
tUIndex mSize
Definition: CORE_MorseArrayIterator.h:31
T * values() const
return the current values
Definition: CORE_MorseArrayIterator.h:129
tUIndex * mIndex
Definition: CORE_MorseArrayIterator.h:29
const tUIndex & size() const
return the number of values at index
Definition: CORE_MorseArrayIterator.h:141
#define tUIndex
Definition: types.h:126
T * mValues
Definition: CORE_MorseArrayIterator.h:27
abstract base class for most classes.
Definition: CORE_Object.h:53
tBoolean operator==(const CORE_MorseArrayIterator< T > &iter) const
test if two iterator are equal
Definition: CORE_MorseArrayIterator.h:120
const tBoolean & increment() const
return the increment between 2 values
Definition: CORE_MorseArrayIterator.h:147
This class describes a more array iterator.
Definition: CORE_MorseArrayIterator.h:15