Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
ExtendedTimeFrequency.cpp
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 #include "cheetah/data/ExtendedTimeFrequency.h"
25 #include "cheetah/data/TimeFrequency.h"
26 
27 namespace ska {
28 namespace cheetah {
29 namespace data {
30 
31 template<typename TimeFrequencyT>
32 ExtendedTimeFrequency<TimeFrequencyT>::ExtendedTimeFrequency(std::shared_ptr<TimeFrequencyT> const& data)
33  : BaseT(data)
34 {
35 }
36 
37 template<typename TimeFrequencyT>
38 ExtendedTimeFrequency<TimeFrequencyT>::~ExtendedTimeFrequency()
39 {
40 }
41 
42 template<typename TimeFrequencyT>
43 ExtendedTimeFrequency<TimeFrequencyT>::operator typename ExtendedTimeFrequency<TimeFrequencyT>::Type const&() const
44 {
45  return this->get();
46 }
47 
48 template<typename TimeFrequencyT>
49 inline
50 typename ExtendedTimeFrequency<TimeFrequencyT>::TimePointType const& ExtendedTimeFrequency<TimeFrequencyT>::start_time() const
51 {
52  return this->get().start_time();
53 }
54 
55 template<typename TimeFrequencyT>
56 inline
57 typename ExtendedTimeFrequency<TimeFrequencyT>::TimePointType ExtendedTimeFrequency<TimeFrequencyT>::start_time(std::size_t offset) const
58 {
59  return this->get().start_time(offset);
60 }
61 
62 template<typename TimeFrequencyT>
63 inline
64 void ExtendedTimeFrequency<TimeFrequencyT>::start_time(typename ExtendedTimeFrequency<TimeFrequencyT>::TimePointType const& time_point)
65 {
66  this->get().start_time(time_point);
67 }
68 
69 template<typename TimeFrequencyT>
70 inline
71 typename ExtendedTimeFrequency<TimeFrequencyT>::TimeType ExtendedTimeFrequency<TimeFrequencyT>::sample_interval() const
72 {
73  return this->get().sample_interval();
74 }
75 
76 template<typename TimeFrequencyT>
77 inline
78 void ExtendedTimeFrequency<TimeFrequencyT>::sample_interval(typename ExtendedTimeFrequency<TimeFrequencyT>::TimeType interval)
79 {
80  return this->get().sample_interval(interval);
81 }
82 
83 template<typename TimeFrequencyT>
84 inline
85 std::vector<typename ExtendedTimeFrequency<TimeFrequencyT>::FrequencyType> const& ExtendedTimeFrequency<TimeFrequencyT>::channel_frequencies() const
86 {
87  return this->get().channel_frequencies();
88 }
89 
90 template<typename TimeFrequencyT>
91 inline
92 std::pair<typename ExtendedTimeFrequency<TimeFrequencyT>::FrequencyType, typename ExtendedTimeFrequency<TimeFrequencyT>::FrequencyType> ExtendedTimeFrequency<TimeFrequencyT>::low_high_frequencies() const
93 {
94  return this->get().low_high_frequencies();
95 }
96 
97 template<typename TimeFrequencyT>
98 inline
99 void ExtendedTimeFrequency<TimeFrequencyT>::set_channel_frequencies_const_width(FrequencyType const& start, FrequencyType const& delta)
100 {
101  this->get().set_channel_frequencies_const_width(start, delta);
102 }
103 
104 template<typename TimeFrequencyT>
105 inline
106 void ExtendedTimeFrequency<TimeFrequencyT>::set_channel(unsigned channel_number, NumericalRep const& value)
107 {
108  this->get().set_channel(channel_number, value);
109 }
110 
111 // specialisation for Extended data types
112 template<typename T>
113 struct ExtractTimeFrequencyDataTypeHelper<T, typename std::enable_if<std::is_base_of<ExtendedTimeFrequencyTag, T>::value>::type>
114 {
115  typedef typename T::TimeFrequencyType type;
116  inline static type& extract(T& t) { return static_cast<type&>(t); }
117  inline static type const& extract(T const& t) { return static_cast<type const&>(t); }
118 };
119 
120 
121 } // namespace data
122 } // namespace cheetah
123 } // namespace ska
std::pair< FrequencyType, FrequencyType > low_high_frequencies() const
Implementation Helper class for the ExtractTimeFrequencyDataType - do not call directly.
Some limits and constants for FLDO.
Definition: Brdz.h:35
Mjd const & start_time() const
Definition: DmTrials.cpp:59
void set_channel(unsigned channel_number, NumericalRep const &value)
sets the value of the specified channel to the provided value across all time samples ...
std::vector< FrequencyType > const & channel_frequencies() const
void set_channel_frequencies_const_width(FrequencyType const &start, FrequencyType const &delta)
Set the frequency index based on evenly spaced channels.
TimePointType const & start_time() const
get the start time of first spectrum