Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
DmTimeSlice.cpp
1 #include "cheetah/data/detail/DmTimeSlice.h"
2 #include "cheetah/data/detail/DmTimeSliceIterator.h"
3 
4 namespace ska {
5 namespace cheetah {
6 namespace data {
7 namespace detail {
8 
9 template <typename DmTimeType>
10 DmTimeSlice<DmTimeType>::DmTimeSlice(std::size_t start_dm_idx, std::size_t number_dms_per_slice,
11  ParentType parent)
12  : _parent(parent)
13  , _start_dm_idx(start_dm_idx)
14  , _number_dms_per_slice(number_dms_per_slice)
15 {
16 }
17 
18 template <typename DmTimeType>
19 DmTimeSlice<DmTimeType>::~DmTimeSlice()
20 {
21 }
22 
23 template <typename DmTimeType>
25 {
26  return Iterator(_start_dm_idx, this->shared_from_this());
27 }
28 
29 template <typename DmTimeType>
31 {
32  return ConstIterator(_start_dm_idx, this->shared_from_this());
33 }
34 
35 template <typename DmTimeType>
37 {
38  // blocks is guaranteed to never be empty so front() will always return
39  std::size_t end_idx = std::min(blocks().front()->size(),_start_dm_idx+_number_dms_per_slice);
40  return Iterator(end_idx, this->shared_from_this());
41 }
42 
43 template <typename DmTimeType>
45 {
46  // blocks is guaranteed to never be empty so front() will always return
47  std::size_t end_idx = std::min(blocks().front()->size(),_start_dm_idx+_number_dms_per_slice);
48  return ConstIterator(end_idx, this->shared_from_this());
49 }
50 
51 template <typename DmTimeType>
52 typename DmTimeSlice<DmTimeType>::ContainerType const& DmTimeSlice<DmTimeType>::blocks() const
53 {
54  return _parent->blocks();
55 }
56 
57 } // namespace detail
58 } // namespace data
59 } // namespace cheetah
60 } // namespace ska
Class that wraps a subset of DMs from a DmTime object.
Definition: DmTimeSlice.h:54
Some limits and constants for FLDO.
Definition: Brdz.h:35
ContainerType const & blocks() const
Get a constant reference to the underlying list of DmTime shared pointers.
Definition: DmTimeSlice.cpp:52
An iterator over a DmTimeSlice object.
Definition: DmTimeSlice.h:42
Iterator begin()
Get an iterator poiting to the start of the slice.
Definition: DmTimeSlice.cpp:24
Iterator end()
Get an iterator poiting to the end of the slice.
Definition: DmTimeSlice.cpp:36