DASH  0.3.0
ListRef.h
1 #ifndef DASH__LIST__LIST_REF_H__INCLUDED
2 #define DASH__LIST__LIST_REF_H__INCLUDED
3 
4 #include <iterator>
5 #include <limits>
6 
7 #include <dash/Types.h>
8 #include <dash/GlobRef.h>
9 #include <dash/Team.h>
10 #include <dash/Exception.h>
11 #include <dash/Cartesian.h>
12 #include <dash/Dimensional.h>
13 #include <dash/memory/GlobHeapMem.h>
14 #include <dash/Allocator.h>
15 
16 #include <dash/iterator/GlobIter.h>
17 
18 #include <dash/list/internal/ListTypes.h>
19 
20 
21 namespace dash {
22 
23 // forward declaration
24 template<
25  typename ElementType,
26  class LMemSpace >
27 class List;
28 
29 // forward declaration
30 template<
31  typename ElementType,
32  class LMemSpace >
34 
40 template<
41  typename ElementType,
42  class LMemSpace >
43 class ListRef
44 {
45 private:
46  static const dim_t NumDimensions = 1;
47 
49 public:
51  typedef ElementType value_type;
54 
55 private:
59  typedef typename list_type::node_type ListNode_t;
60  typedef typename list_type::glob_mem_type glob_mem_type;
61 
63 public:
64  typedef typename std::make_unsigned<index_type>::type size_type;
65 
66  typedef typename list_type::iterator iterator;
68  typedef typename list_type::reverse_iterator reverse_iterator;
69  typedef typename list_type::const_reverse_iterator const_reverse_iterator;
70  typedef typename list_type::reference reference;
72  typedef typename list_type::pointer pointer;
73  typedef typename list_type::const_pointer const_pointer;
76 
77 public:
80  list_type * list,
82  const ViewSpec_t & viewspec)
83  : _list(list),
84  _viewspec(viewspec)
85  { }
86 
87 public:
94  inline void push_back(const value_type & value)
95  {
97  "dash::ListRef.push_back is not implemented");
98  }
99 
104  void pop_back()
105  {
107  "dash::ListRef.pop_back is not implemented");
108  }
109 
113  reference back()
114  {
116  "dash::ListRef.back is not implemented");
117  }
118 
125  inline void push_front(const value_type & value)
126  {
128  "dash::ListRef.push_front is not implemented");
129  }
130 
135  void pop_front()
136  {
138  "dash::ListRef.pop_front is not implemented");
139  }
140 
144  reference front()
145  {
147  "dash::ListRef.front is not implemented");
148  }
149 
150  inline Team & team() const noexcept;
151 
152  inline size_type size() const noexcept;
153  inline size_type local_size() const noexcept;
154  inline size_type local_capacity() const noexcept;
155  inline bool empty() const noexcept;
156 
157  inline void barrier() const;
158 
159  inline const_pointer data() const noexcept;
160  inline iterator begin() noexcept;
161  inline const_iterator begin() const noexcept;
162  inline iterator end() noexcept;
163  inline const_iterator end() const noexcept;
165  inline local_pointer lbegin() const noexcept;
167  inline local_pointer lend() const noexcept;
168 
169 private:
171  list_type * _list;
173  ViewSpec_t _viewspec;
174 
175 }; // class ListRef
176 
177 } // namespace dash
178 
179 #endif // DASH__LIST__LIST_REF_H__INCLUDED
This class is a simple memory pool which holds allocates elements of size ValueType.
Definition: AllOf.h:8
void pop_back()
Removes and destroys the last element in the list, reducing the container size by one...
Definition: ListRef.h:104
reference front()
Accesses the first element in the list.
Definition: ListRef.h:144
void push_front(const value_type &value)
Inserts a new element at the beginning of the list, before its current first element.
Definition: ListRef.h:125
int dim_t
Scalar type for a dimension value, with 0 indicating the first dimension.
Definition: Types.h:39
std::make_unsigned< index_type >::type size_type
Public types as required by STL list concept:
Definition: ListRef.h:64
Usage examples:
Definition: ListRef.h:27
Proxy type referencing a dash::List.
Definition: ListRef.h:43
ListRef(list_type *list, const ViewSpec_t &viewspec)
Definition: ListRef.h:78
Global memory region with dynamic size.
Definition: GlobHeapMem.h:204
internal::default_signed_index default_index_t
Signed integer type used as default for index values.
Definition: Types.h:59
A Team instance specifies a subset of all available units.
Definition: Team.h:41
local_pointer lbegin() const noexcept
Pointer to first element in local range.
Iterator on global buckets.
Definition: GlobHeapMem.h:32
local_pointer lend() const noexcept
Pointer past final element in local range.
void pop_front()
Removes and destroys the first element in the list, reducing the container size by one...
Definition: ListRef.h:135
Proxy type representing a local view on a referenced dash::List.
Definition: ListRef.h:33
dash::default_index_t index_type
Type definitions required for DASH list concept:
Definition: ListRef.h:50
reference back()
Accesses the last element in the list.
Definition: ListRef.h:113
void push_back(const value_type &value)
Inserts a new element at the end of the list, after its current last element.
Definition: ListRef.h:94