Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
TimeFrequencyContainer.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_TIMEFREQUENCYCONTAINER_H
25 #define SKA_CHEETAH_DATA_TIMEFREQUENCYCONTAINER_H
26 
27 #include "TimeFrequency.h"
28 #include "panda/MultiIterator.h"
29 #include <memory>
30 #include <vector>
31 
32 namespace ska {
33 namespace cheetah {
34 namespace data {
35 
36 
41 template <class Arch, typename NumericalT>
43 {
44  public:
46  typedef typename TimeFrequencyType::FrequencyType FrequencyType;
47  typedef typename TimeFrequencyType::TimeType TimeType;
48  typedef typename TimeFrequencyType::TimePointType TimePointType;
49  template<class ChannelIterationEndHandler=panda::NoOp, class TimeDiscontinuityHandler=panda::NoOp>
50  struct ConstChannelIterator;
52 
53  public:
56 
60  void add(TimeFrequencyType& data);
61  void add(std::shared_ptr<TimeFrequencyType> const& data);
62 
66  void clear();
67 
71  bool empty() const;
72 
76  TimePointType const& start_time() const;
77 
81  std::size_t number_of_channels() const;
82 
86  std::size_t number_of_spectra() const;
87 
91  TimeType sample_interval() const;
92 
96  std::vector<FrequencyType> const& channel_frequencies() const;
97 
113  template<class ChannelIterationEndHandler, class TimeDiscontinuityHandler>
114  ConstChannelIterator<ChannelIterationEndHandler, TimeDiscontinuityHandler> begin(ChannelIterationEndHandler, TimeDiscontinuityHandler) const;
115 
120 
121  private:
122  std::vector<std::shared_ptr<TimeFrequencyType>> _data;
123  std::size_t _number_of_spectra;
124 };
125 
126 
127 } // namespace data
128 } // namespace cheetah
129 } // namespace ska
130 #include "detail/TimeFrequencyContainer.cpp"
131 
132 #endif // SKA_CHEETAH_DATA_TIMEFREQUENCYCONTAINER_H
bool empty() const
return true if there is no data
Provides the TimeFrequency API over a set of TimeFrequency objects.
Some limits and constants for FLDO.
Definition: Brdz.h:35
ConstEndChannelIterator end() const
return the end iterator
void add(TimeFrequencyType &data)
add data to the collection
ConstChannelIterator< ChannelIterationEndHandler, TimeDiscontinuityHandler > begin(ChannelIterationEndHandler, TimeDiscontinuityHandler) const
std::vector< FrequencyType > const & channel_frequencies() const