Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
DataSequence2DSlowIterator.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_DATASEQUENCE2DSLOWITERATOR_H
25 #define SKA_CHEETAH_DATA_DATASEQUENCE2DSLOWITERATOR_H
26 #include <boost/iterator/iterator_facade.hpp>
27 #include <type_traits>
28 
29 
30 namespace ska {
31 namespace cheetah {
32 namespace data {
33 
38 template <typename Arch, typename Type>
40 };
41 
42 template<typename Arch, typename T>
43 class DataSequence2D;
44 
45 // Cpu Specialization
46 template <typename Type>
47 class DataSequence2DSlowIterator<Cpu, Type> : public boost::iterator_facade<
48  DataSequence2DSlowIterator<Cpu, Type>
49  , Type
50  , std::random_access_iterator_tag
51  >
52 {
53  private:
55  typedef boost::iterator_facade<SelfType, Type, std::random_access_iterator_tag> BaseT;
56  typedef typename BaseT::pointer PtrType;
57  typedef typename BaseT::reference RefType;
58  typedef typename BaseT::difference_type DiffType;
59 
60  public:
61  explicit DataSequence2DSlowIterator(const DataSequence2D<Cpu,typename std::remove_cv<Type>::type> &data,
62  std::size_t fast_offset=0);
63 
64  explicit DataSequence2DSlowIterator(DataSequence2D<Cpu,typename std::remove_cv<Type>::type> &data,
65  std::size_t fast_offset=0);
67 
68  private:
69  friend class boost::iterator_core_access;
70 
71  bool equal(SelfType const& other) const;
72  void increment();
73  void decrement();
74  void advance(std::size_t n);
75  RefType dereference() const;
76  DiffType distance_to(SelfType const& right) const;
77 
78  private:
80  std::size_t _pos;
81  std::size_t _offset;
82 };
83 
84 } // namespace data
85 } // namespace cheetah
86 } // namespace ska
87 #include "cheetah/data/detail/DataSequence2DSlowIterator.cpp"
88 
89 #endif // SKA_CHEETAH_DATA_DATASEQUENCE2DSLOWITERATOR_H
Iterator over DataSequence2D types, over "fast" axis. Generic type.
Some limits and constants for FLDO.
Definition: Brdz.h:35
A 2-dimensional sequencial data of type T.
A generic iterator for DataSequence2D.