C++ main module for emicrom Package  1.0
CORE_MorseArrayConstIterator.h
Go to the documentation of this file.
1 #ifndef CORE_MorseArrayConstIterator_H
2 #define CORE_MorseArrayConstIterator_H
3 
4 #include "CORE_Object.h"
5 
6 #include "CORE_MorseArray.h"
7 
8 
16 template<class T>
18 
19 
20  // ATTRIBUTES
21 
22 public:
23 
24 
25 
26 private:
27 
28  const T *mValues;
29  const tUIndex *mIndex;
32 
33 public:
34  // METHODS
35 
36  // CONSTRUCTORS
37 
41  mValues=null;
42  mIndex=null;
43  mSize=0;
44  mIncrement=0;
45  }
46 
47 
48 
49  // DESTRUCTORS
50 
51 
55 
56  }
57 
58 public:
59 
60  //operator
61 
62 
63  // ACCESSORS
64  //==========
65 
66 
67 
68 
69 public:
70 
71 
72 
73 public:
79  inline void init(const T* values,
80  const tUIndex* index,
81  const tBoolean& inc) {
82  mValues=values;
83  mIndex=index;
84  mSize=(*(mIndex+1))-(*mIndex);
85  mIncrement=inc;
86  }
93  inline void init(const T* values,
94  const tUIndex* index,
95  const tUIndex& s,
96  const tBoolean& inc) {
97  mValues=values;
98  mIndex=index;
99  mSize=s;
100  mIncrement=inc;
101  }
102 
105  inline tBoolean hasNext() const {
106  return ((*mIndex)!=mSize);
107  }
111  //next index
112  mIndex+=mIncrement;
113  //next values
114  mValues+=mSize*mIncrement;
115  //next size
116  mSize=(*(mIndex+1))-(*mIndex);
117  return (*this);
118  }
119 
125  return (mIndex!=&iter.index());
126  }
127 
133  return (mIndex==&iter.index());
134  }
135 
136 
140  inline const T* values() const {
141  return mValues;
142  }
146  inline const tUIndex& index() const {
147  return *mIndex;
148  }
152  inline const tUIndex& size() const {
153  return mSize;
154  }
155 
159  inline const tBoolean& increment() const {
160  return increment;
161  }
162 
163 
164 };
165 
166 
167 #endif
const tUIndex & size() const
return the number of values at index
Definition: CORE_MorseArrayConstIterator.h:152
const tBoolean & increment() const
return the increment between 2 values
Definition: CORE_MorseArrayConstIterator.h:159
const tUIndex * mIndex
Definition: CORE_MorseArrayConstIterator.h:29
CORE_MorseArrayConstIterator()
create an empty iterator
Definition: CORE_MorseArrayConstIterator.h:40
const tUIndex & index() const
return the current index
Definition: CORE_MorseArrayConstIterator.h:146
virtual ~CORE_MorseArrayConstIterator(void)
destroy
Definition: CORE_MorseArrayConstIterator.h:54
#define tBoolean
Definition: types.h:139
tUIndex mSize
Definition: CORE_MorseArrayConstIterator.h:30
#define null
Definition: types.h:144
This class describes a more array iterator.
Definition: CORE_MorseArrayConstIterator.h:17
CORE_MorseArrayConstIterator< T > & operator++()
increment the iterator: get the values of next element
Definition: CORE_MorseArrayConstIterator.h:110
#define tUIndex
Definition: types.h:126
void init(const T *values, const tUIndex *index, const tBoolean &inc)
init an iterator to pointers
Definition: CORE_MorseArrayConstIterator.h:79
abstract base class for most classes.
Definition: CORE_Object.h:53
tBoolean hasNext() const
return true of element has next element
Definition: CORE_MorseArrayConstIterator.h:105
const T * mValues
Definition: CORE_MorseArrayConstIterator.h:28
const T * values() const
return the current values
Definition: CORE_MorseArrayConstIterator.h:140
tBoolean mIncrement
Definition: CORE_MorseArrayConstIterator.h:31
tBoolean operator==(const CORE_MorseArrayConstIterator< T > &iter) const
test if two iterator are equal
Definition: CORE_MorseArrayConstIterator.h:132
void init(const T *values, const tUIndex *index, const tUIndex &s, const tBoolean &inc)
init an iterator to pointers
Definition: CORE_MorseArrayConstIterator.h:93
tBoolean operator!=(const CORE_MorseArrayConstIterator< T > &iter) const
test if two iterator are not equal
Definition: CORE_MorseArrayConstIterator.h:124