DASH  0.3.0
View.h
1 #ifndef DASH__VIEW_H__INCLUDED
2 #define DASH__VIEW_H__INCLUDED
3 
74 #include <dash/view/Apply.h>
75 #include <dash/view/Block.h>
76 #include <dash/view/Chunked.h>
77 #include <dash/view/Domain.h>
78 #include <dash/view/Origin.h>
79 #include <dash/view/Global.h>
80 #include <dash/view/Local.h>
81 #include <dash/view/Remote.h>
82 #include <dash/view/Apply.h>
83 #include <dash/view/Sub.h>
84 
85 #include <dash/view/SetUnion.h>
86 #include <dash/view/SetIntersect.h>
87 
88 #include <dash/view/IndexSet.h>
89 #include <dash/view/IndexRange.h>
90 #include <dash/view/CartView.h>
91 
92 #include <dash/view/MultiView.h>
93 #include <dash/view/StridedView.h>
94 
95 #include <dash/view/ViewTraits.h>
96 
97 #include <dash/view/ViewMod.h>
98 #include <dash/view/ViewBlocksMod.h>
99 
100 #include <dash/Range.h>
101 
102 
103 namespace dash {
104 
105 template <
106  class Iterator,
107  class Sentinel >
109 
110 template <
111  class Iterator,
112  class Sentinel >
113 struct view_traits<IteratorViewOrigin<Iterator, Sentinel> > {
117 
118  // Uses container::local_type directly, e.g. dash::LocalArrayRef:
119  // typedef typename dash::view_traits<domain_type>::local_type local_type;
120  // Uses ViewLocalMod wrapper on domain, e.g. ViewLocalMod<dash::Array>:
122  typedef ViewGlobalMod<domain_type> global_type;
123 
124  typedef typename Iterator::index_type index_type;
125  typedef dash::IndexSetIdentity<
127 
128  typedef std::integral_constant<bool, false> is_projection;
129  typedef std::integral_constant<bool, true> is_view;
130  typedef std::integral_constant<bool, true> is_origin;
131  typedef std::integral_constant<bool, false> is_local;
132 };
133 
134 template <
135  class Iterator,
136  class Sentinel
137 >
138 class IteratorViewOrigin
139 : public dash::IteratorRange<Iterator, Sentinel>
140 {
141 public:
142  typedef typename Iterator::index_type index_type;
143 private:
145  typedef IteratorRange<Iterator, Sentinel> base_t;
146 public:
147  typedef self_t domain_type;
148  typedef self_t origin_type;
149  typedef self_t image_type;
150  // Alternative: IteratorLocalView<self_t, Iterator, Sentinel>
151  typedef typename view_traits<domain_type>::local_type local_type;
152  typedef typename view_traits<domain_type>::global_type global_type;
153 
154  typedef typename Iterator::pattern_type pattern_type;
155 public:
156  constexpr IteratorViewOrigin(Iterator begin, Iterator end)
157  : base_t(std::move(begin), std::move(end)) {
158  }
159 
160  constexpr const pattern_type & pattern() const {
161  return this->begin().pattern();
162  }
163 
164  constexpr local_type local() const {
165  // for local_type: IteratorLocalView<self_t, Iterator, Sentinel>
166  // return local_type(this->begin(), this->end());
167  return local_type(*this);
168  }
169 
170 };
171 
172 
173 template <class Iterator, class Sentinel>
175 make_view(Iterator begin, Sentinel end) {
177  std::move(begin),
178  std::move(end));
179 }
180 
181 } // namespace dash
182 
183 
184 #endif // DASH__VIEW_H__INCLUDED
constexpr auto end(RangeType &&range) -> decltype(std::forward< RangeType >(range).end())
Definition: Range.h:98
constexpr auto local(ViewType &v) -> typename std::enable_if<(std::is_pointer< typename ViewType::iterator >::value||(dash::view_traits< ViewValueT >::is_local::value)), ViewType &>::type
Definition: Local.h:28
This class is a simple memory pool which holds allocates elements of size ValueType.
Definition: AllOf.h:8
constexpr auto begin(RangeType &&range) -> decltype(std::forward< RangeType >(range).begin())
Definition: Range.h:89
View type traits.
Definition: ViewTraits.h:31
Adapter template for range concept, wraps begin and end iterators in range type.
Definition: Range.h:304