DASH  0.3.0
GlobListIter.h
1 #ifndef DASH__LIST__GLOB_LIST_ITER_H__INCLUDED
2 #define DASH__LIST__GLOB_LIST_ITER_H__INCLUDED
3 
4 #include <dash/GlobPtr.h>
5 #include <dash/GlobRef.h>
6 
7 #include <dash/list/internal/ListTypes.h>
8 
9 #include <iterator>
10 
11 
12 namespace dash {
13 
20 template<
21  typename ElementType,
22  class GlobMemType,
23  class PointerType = GlobPtr<ElementType, GlobMemType>,
24  class ReferenceType = GlobRef<ElementType> >
26 : public std::iterator<
27  std::bidirectional_iterator_tag,
28  ElementType,
29  dash::default_index_t,
30  PointerType,
31  ReferenceType >
32 {
33 private:
34  typedef GlobListIter<
35  ElementType,
36  GlobMemType,
37  PointerType,
38  ReferenceType>
39  self_t;
40 
41 public:
42  typedef ElementType value_type;
43  typedef ReferenceType reference;
44  typedef const ReferenceType const_reference;
45  typedef PointerType pointer;
46  typedef const PointerType const_pointer;
47 
48  typedef typename GlobMemType::local_pointer local_pointer;
49 
50  typedef internal::ListNode<value_type> node_type;
51 
52 public:
53  typedef std::integral_constant<bool, false> has_view;
54 
55 public:
59  GlobListIter() = default;
60 
65  GlobMemType * gmem,
66  node_type & node)
67  : _globmem(gmem),
68  _node(&node),
69  _myid(dash::Team::GlobalUnitID())
70  {
71  DASH_LOG_TRACE("GlobListIter(gmem,node,pat)");
72  }
73 
78  const self_t & other) = default;
79 
83  self_t & operator=(
84  const self_t & other) = default;
85 
91  operator pointer() const
92  {
93  pointer ptr;
94  // TODO
95  return ptr;
96  }
97 
103  reference operator*()
104  {
105  return reference(this);
106  }
107 
114  const_reference operator*() const
115  {
116  }
117 
121  inline self_t global() const
122  {
123  return *this;
124  }
125 
133  inline constexpr bool is_relative() const noexcept
134  {
135  return false;
136  }
137 
142  inline const GlobMemType & globmem() const
143  {
144  return *_globmem;
145  }
146 
151  inline GlobMemType & globmem()
152  {
153  return *_globmem;
154  }
155 
159  inline self_t & operator++()
160  {
161  increment();
162  return *this;
163  }
164 
168  inline self_t operator++(int)
169  {
170  self_t result = *this;
171  increment();
172  return result;
173  }
174 
178  inline self_t & operator--()
179  {
180  decrement();
181  return *this;
182  }
183 
187  inline self_t operator--(int)
188  {
189  self_t result = *this;
190  decrement();
191  return result;
192  }
193 
197  inline bool operator==(const self_t & other) const
198  {
199  return _node == other._node;
200  }
201 
205  inline bool operator!=(const self_t & other) const
206  {
207  return _node != other._node;
208  }
209 
210 private:
211 
212  void increment()
213  {
214  }
215 
216  void decrement()
217  {
218  }
219 
220 private:
222  GlobMemType * _globmem{};
224  node_type * _node = nullptr;
226  team_unit_t _myid;
227 
228 }; // class GlobListIter
229 
230 } // namespace dash
231 
232 #endif // DASH__LIST__GLOB_LIST_ITER_H__INCLUDED
self_t operator--(int)
Postfix decrement operator.
Definition: GlobListIter.h:187
This class is a simple memory pool which holds allocates elements of size ValueType.
Definition: AllOf.h:8
self_t & operator=(const self_t &other)=default
Assignment operator.
const_reference operator*() const
Dereference operator.
Definition: GlobListIter.h:114
constexpr bool is_relative() const noexcept
Whether the iterator&#39;s position is relative to a view.
Definition: GlobListIter.h:133
bool operator!=(const self_t &other) const
Inequality comparison operator.
Definition: GlobListIter.h:205
const GlobMemType & globmem() const
The instance of GlobStaticMem used by this iterator to resolve addresses in global memory...
Definition: GlobListIter.h:142
self_t operator++(int)
Postfix increment operator.
Definition: GlobListIter.h:168
GlobListIter()=default
Default constructor.
self_t & operator--()
Prefix decrement operator.
Definition: GlobListIter.h:178
GlobListIter(GlobMemType *gmem, node_type &node)
Constructor, creates a global iterator on a dash::List instance.
Definition: GlobListIter.h:64
A Team instance specifies a subset of all available units.
Definition: Team.h:41
GlobMemType & globmem()
The instance of GlobStaticMem used by this iterator to resolve addresses in global memory...
Definition: GlobListIter.h:151
Bi-directional global iterator on elements of a dash::List instance.
Definition: GlobListIter.h:25
self_t & operator++()
Prefix increment operator.
Definition: GlobListIter.h:159
reference operator*()
Dereference operator.
Definition: GlobListIter.h:103
struct dash::unit_id< dash::local_unit, dart_team_unit_t > team_unit_t
Unit ID to use for team-local IDs.
Definition: Types.h:319
self_t global() const
Map iterator to global index domain.
Definition: GlobListIter.h:121
bool operator==(const self_t &other) const
Equality comparison operator.
Definition: GlobListIter.h:197