Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
FldoHandler.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_PIPELINE_FLDOHANDLER_H
25 #define SKA_CHEETAH_PIPELINE_FLDOHANDLER_H
26 
27 #include <panda/TypeTraits.h>
28 #include <memory>
29 #include <type_traits>
30 
31 namespace ska {
32 namespace cheetah {
33 namespace pipeline {
34 namespace detail {
35 
36 /*
37  * @brief Wrapper class for managing thr fldo handler used in AccelerationSearch pipeline
38  * @details Implementation specific to AccelerationSearch class
39  */
40 template<typename AccelerationSearchType, typename Enable=void>
41 struct FldoHandler {
42  public:
44 
45  public:
46  FldoHandler(AccelerationSearchType& pipeline)
47  : _out(pipeline.out())
48  {
49  }
50 
51  void operator()(std::shared_ptr<data::Ocld> const& data)
52  {
53  _out.send(panda::ChannelId("ocld"), data);
54  }
55 
56  FldoHandlerType const& handler() const
57  {
58  return _out;
59  }
60 
61  private:
62  FldoHandlerType& _out;
63 };
64 
65 template<typename AccelerationSearchType>
66 struct FldoHandler<AccelerationSearchType, typename std::enable_if<panda::HasMethod<typename AccelerationSearchType::Traits, AccelerationSearchType::template has_create_fldo_handler_t>::value>::type>
67 {
68  typedef typename AccelerationSearchType::Traits Traits;
69 
70  public:
71  typedef typename std::remove_pointer<typename AccelerationSearchType::template has_create_fldo_handler_t<Traits>>::type FldoHandlerType;
72 
73  FldoHandler(AccelerationSearchType& pipeline)
74  : _fldo_handler(Traits::create_fldo_handler(pipeline.out(), pipeline._config, pipeline._beam_config))
75  {
76  }
77 
78  void operator()(std::shared_ptr<data::Ocld> const& data) const
79  {
80  _fldo_handler->operator()(data);
81  }
82 
83  FldoHandlerType const& handler() const {
84  return *_fldo_handler;
85  }
86 
87  private:
88  std::unique_ptr<FldoHandlerType> _fldo_handler;
89 };
90 
91 } // namespace detail
92 } // namespace pipeline
93 } // namespace cheetah
94 } // namespace ska
95 
96 #endif // SKA_CHEETAH_PIPELINE_FLDOHANDLER_H
Some limits and constants for FLDO.
Definition: Brdz.h:35