Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
DataSequence2DFastIterator.h
1 /*
2  * The MIT License (MIT)
3  *
4  * Copyright (c) 2016 The SKA organisation
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #ifndef SKA_CHEETAH_DATA_DATASEQUENCE2DFASTITERATOR_H
25 #define SKA_CHEETAH_DATA_DATASEQUENCE2DFASTITERATOR_H
26 
27 #include <iterator>
28 #include <memory>
29 
30 #include "cheetah/data/DataSequence2DIterator.h"
31 
32 namespace ska {
33 namespace cheetah {
34 namespace data {
35 
40 template <typename Arch, typename Type>
42 };
43 
44 template<typename Arch, typename T>
45 class DataSequence2D;
46 
52 template <typename Type, typename DerivedType>
53 class DataSequence2DFastIteratorBase : public std::iterator<std::random_access_iterator_tag, Type,std::size_t,Type*,Type&>
54 {
56 
57  public:
58  typedef typename std::iterator_traits<SelfType>::pointer PtrType;
59  typedef typename std::iterator_traits<SelfType>::reference RefType;
60  typedef typename std::iterator_traits<SelfType>::difference_type DiffType;
61 
62  public:
71  explicit DataSequence2DFastIteratorBase(const DataSequence2D<Cpu, typename std::remove_cv<Type>::type> &data_ptr,
72  std::size_t slow_offset=0);
73 
74  explicit DataSequence2DFastIteratorBase(DataSequence2D<Cpu, typename std::remove_cv<Type>::type> &data_ptr,
75  std::size_t slow_offset=0);
76 
81 
86 
91 
92 
97  virtual PtrType operator->() const;
98 
102  virtual RefType operator*() const;
103 
104 
111  DerivedType& operator++();
112 
117  DerivedType operator++(int);
118 
122  DerivedType& operator--();
123 
127  DerivedType operator--(int);
128 
132  DerivedType& operator+=(DiffType off);
133 
137  DerivedType& operator-=(DiffType off);
138 
142  DerivedType operator+(DiffType off) const;
143 
147  DerivedType operator-(DiffType off) const;
148 
152  DiffType operator-(const SelfType &right) const;
153 
157  bool operator<(const SelfType &right) const;
158 
162  bool operator>(const SelfType &right) const;
163 
167  bool operator<=(const SelfType &right) const;
168 
172  bool operator>=(const SelfType &right) const;
173 
177  RefType operator[](DiffType off) const;
178 
182  bool operator==(SelfType const&) const;
183 
187  bool operator!=(SelfType const&) const;
188 
189  protected:
190  std::size_t index();
192  std::size_t _offset=0;
193  Type* _raw;
194 
195 };
196 
197 template <typename Type>
198 class DataSequence2DFastIterator<Cpu,Type> : public DataSequence2DFastIteratorBase<Type, DataSequence2DFastIterator<Cpu, Type>>
199 {
201 
202  public:
203  using BaseT::BaseT;
204 
205 };
206 
207 } // namespace data
208 } // namespace cheetah
209 } // namespace ska
210 
211 #include "cheetah/data/detail/DataSequence2DFastIterator.cpp"
212 
213 #endif // SKA_CHEETAH_DATA_DATASEQUENCE2DFASTITERATOR_H
Iterator over DataSequence2D types, over "fast" axis. Generic type.
Iterator over DataSequence2D types, over "fast" axis. CPU specific type.
Some limits and constants for FLDO.
Definition: Brdz.h:35
A 2-dimensional sequencial data of type T.
A generic iterator for DataSequence2D.