Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
Psbc.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_PSBC_PSBC_H
25 #define SKA_CHEETAH_PSBC_PSBC_H
26 
27 #include "cheetah/psbc/Config.h"
28 #include "cheetah/data/DmTime.h"
29 #include "cheetah/data/DmTrials.h"
30 #include "cheetah/data/Units.h"
31 #include <vector>
32 #include <mutex>
33 #include <memory>
34 
35 namespace ska {
36 namespace cheetah {
37 namespace psbc {
38 
44 typedef data::DmTrials<cheetah::Cpu,float> DmTrialsType;
45 typedef data::DmTime<DmTrialsType> DmTimeType;
46 
56 template<typename Handler>
57 class Psbc
58 {
59  public:
60  typedef typename DmTimeType::ValueType DataType;
61  typedef DmTrialsType::TimeType Seconds; // This should not come from DmTrialsType it should be independent
62 
63  public:
70  Psbc(Config const& config, Handler& handler);
71  Psbc(Psbc const&) = delete;
72  Psbc(Psbc&&) = default;
73  ~Psbc();
74 
78  void operator()(DataType const&);
79 
85  bool is_contiguous() const;
86 
87  private:
88  Seconds _duration;
89  Seconds _dump_time;
90  std::shared_ptr<DmTimeType> _data;
91  Handler& _handler;
92  std::unique_ptr<std::mutex> _mutex;
93 };
94 
95 
96 } // namespace psbc
97 } // namespace cheetah
98 } // namespace ska
99 #include "cheetah/psbc/detail/Psbc.cpp"
100 
101 #endif // SKA_CHEETAH_PSBC_PSBC_H
void operator()(DataType const &)
add a DmTrials shared pointer to the underlying container
Definition: Psbc.cpp:49
A class for buffering DmTrials objects.
Definition: Psbc.h:57
bool is_contiguous() const
Determines if blocks in the buffer are contiguous in time.
Definition: Psbc.cpp:93
Some limits and constants for FLDO.
Definition: Brdz.h:35
Configuration for the data collection buffer.
Definition: Config.h:41
Psbc(Config const &config, Handler &handler)
Construct a new instance.
Definition: Psbc.cpp:34