Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
SpCandidateData.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/SpCandidateData.h"
25 
26 
27 namespace ska {
28 namespace cheetah {
29 namespace data {
30 
31 template<typename TimeFrequencyT>
32 SpCandidateData<TimeFrequencyT>::SpCandidateData()
33  : BaseT(std::shared_ptr<TimeFrequencyT>(nullptr))
34 {
35 }
36 
37 
38 template<typename TimeFrequencyT>
39 SpCandidateData<TimeFrequencyT>::SpCandidateData(std::shared_ptr<TimeFrequencyT> const& data)
40  : BaseT(data)
41 {
42 }
43 
44 template<typename TimeFrequencyT>
45 SpCandidateData<TimeFrequencyT>::~SpCandidateData()
46 {
47 }
48 
49 template<typename TimeFrequencyT>
50 void SpCandidateData<TimeFrequencyT>::add(CandidateType&& candidate)
51 {
52  _cands.emplace_back(std::move(candidate));
53 }
54 
55 template<typename TimeFrequencyT>
56 typename SpCandidateData<TimeFrequencyT>::ConstCandidateIterator SpCandidateData<TimeFrequencyT>::begin_candidates() const
57 {
58  return _cands.begin();
59 }
60 
61 template<typename TimeFrequencyT>
62 typename SpCandidateData<TimeFrequencyT>::ConstCandidateIterator SpCandidateData<TimeFrequencyT>::end_candidates() const
63 {
64  return _cands.end();
65 }
66 
67 template<typename TimeFrequencyT>
69 {
70  return _cands.size();
71 }
72 
73 template<typename TimeFrequencyT>
74 typename SpCandidateData<TimeFrequencyT>::CandidateType const& SpCandidateData<TimeFrequencyT>::candidate(std::size_t candidate_number) const
75 {
76  return _cands[candidate_number];
77 }
78 
79 // ----------------- Cadidate<T> -------------------------
80 template<typename TimeFrequencyT>
81 template<typename T>
83 {
84 }
85 
86 template<typename TimeFrequencyT>
87 template<typename T>
88 SpCandidateData<TimeFrequencyT>::Candidate<T>::Candidate(Dm dm, TimePointType start_time_mjd, Width width, Duration duration, T sigma)
89  : _dm(dm)
90  , _start_time(start_time_mjd)
91  , _duration(duration)
92  , _width(width)
93  , _sigma(sigma)
94 {
95 }
96 
97 template<typename TimeFrequencyT>
98 template<typename T>
100 {
101  return _dm;
102 }
103 
104 template<typename TimeFrequencyT>
105 template<typename T>
107 {
108  return _start_time;
109 }
110 
111 template<typename TimeFrequencyT>
112 template<typename T>
114 {
115  return _duration;
116 }
117 
118 template<typename TimeFrequencyT>
119 template<typename T>
121 {
122  return _sigma;
123 }
124 
125 template<typename TimeFrequencyT>
126 template<typename T>
128 {
129  return _width;
130 }
131 
132 
133 } // namespace data
134 } // namespace cheetah
135 } // namespace ska
T const & sigma() const
access a reference to _sigma.
Dm const & dm() const
access a reference to dm.
Some limits and constants for FLDO.
Definition: Brdz.h:35
std::size_t number_of_candidates() const
the number of candidates associated with this data
ConstCandidateIterator begin_candidates() const
Iterator over the candidates.
SpCandidates associated with a single data chank.
CandidateType const & candidate(std::size_t candidate_number) const
get the correspondin numbered candidate (<= number_of_candidates())
MsecTimeType const & width() const
access a reference to width.
void add(CandidateType &&candidate)
add a Candidate to the candidates list
TimePointType const & start_time() const
get the start time of first spectrum
ConstCandidateIterator end_candidates() const
Iterator marking the end of any candidates.