DASH  0.3.0
PatternIterator.h
1 #ifndef DASH__PATTERN_ITERATOR_H_
2 #define DASH__PATTERN_ITERATOR_H_
3 
4 namespace dash {
5 
42 template<
43  class PatternType,
44  typename IndexType = dash::default_index_t>
46 private:
48 
49 private:
50  const PatternType & _pattern;
51  IndexType _global_pos;
52 
53 public:
55  private:
57  typedef PatternLocalIterator self_t;
58 
59  private:
60  const pattern_it_t & _pattern_it;
61 
62  public:
63  PatternLocalIterator(const pattern_it_t & pattern_it)
64  : _pattern_it(pattern_it) {
65  }
66  };
67 
73  const PatternType & pattern)
74  : _pattern(pattern),
75  _global_pos(0) {
76  }
77 
83  const self_t & other)
84  : _pattern(other._pattern),
85  _global_pos(other._global_pos) {
86  }
87 
92  typename PatternType::local_index_t operator*() {
93  return _pattern.local(_global_pos);
94  }
95 
99  self_t & operator++() {
100  ++_global_pos;
101  return *this;
102  }
103 
107  self_t operator++(int) {
108  self_t ret(*this);
109  ++_global_pos;
110  return ret;
111  }
112 
116  self_t & operator--() {
117  --_global_pos;
118  return *this;
119  }
120 
124  self_t operator--(int) {
125  self_t ret(*this);
126  --_global_pos;
127  return ret;
128  }
129 
130 private:
134  PatternIterator() = delete;
135 };
136 
137 } // namespace dash
138 
139 #endif // DASH__PATTERN_ITERATOR_H_
This class is a simple memory pool which holds allocates elements of size ValueType.
Definition: AllOf.h:8
PatternIterator(const PatternType &pattern)
Constructor.
self_t & operator++()
Prefix increment operator.
self_t operator++(int)
Postfix increment operator.
internal::default_signed_index default_index_t
Signed integer type used as default for index values.
Definition: Types.h:59
self_t operator--(int)
Postfix decrement operator.
PatternIterator(const self_t &other)
Copy constructor.
self_t & operator--()
Prefix decrement operator.
PatternType::local_index_t operator*()
Dereference operator, returns unit and local offset at current iterator position in global cartesian ...