Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
Factory.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/producers/Factory.h"
25 #include "cheetah/producers/SpCclSpeadProducer.h"
26 #include "panda/Pipeline.h"
27 #include "panda/Log.h"
28 
29 
30 namespace ska {
31 namespace cheetah {
32 namespace producers {
33 
34 template<typename DataType>
35 template<typename ComputeModule>
36 int Factory<DataType>::exec(std::string const&, ComputeModule&)
37 {
38  static_assert(std::is_same<DataType, std::true_type>::value, "unrecognised datatype");
39  return 0;
40 }
41 
42 template<typename NumericalT>
44  : _config(producers_config)
45 {
46 }
47 
48 template<typename NumericalT>
49 std::vector<std::string> Factory<data::SpCandidateData<data::TimeFrequency<Cpu, NumericalT>>>::available() const
50 {
51  return { "spead" };
52 }
53 
54 
55 template<typename NumericalT>
56 template<typename ComputeModule>
57 int Factory<data::SpCandidateData<data::TimeFrequency<Cpu, NumericalT>>>::exec(std::string const& stream_name, ComputeModule& pipeline)
58 {
59  int rv = 1;
60  if(stream_name == "spead")
61  {
62 #ifdef ENABLE_SPEAD
63  SpCclSpeadProducer<TimeFrequencyType> data_stream(_config.spead_config());
64  rv=panda::Pipeline<SpCclSpeadProducer<TimeFrequencyType>>(data_stream, [&](DataType& data) { pipeline(data); } ).exec();
65 #else // ENABLE_SPEAD
66  (void) pipeline;
67  PANDA_LOG_ERROR << "spead producer has not been compiled in. Recompile with the -DENABLE_SPEAD=truei option set in cmake";
68 #endif // ENABLE_SPEAD
69  }
70  else {
71  PANDA_LOG_ERROR << "unknown source stream: " << stream_name;
72  }
73  return rv;
74 }
75 
76 } // namespace producers
77 } // namespace cheetah
78 } // namespace ska
Some limits and constants for FLDO.
Definition: Brdz.h:35
int exec(std::string const &stream_name, ComputeModule &pipeline)
Launch the provided pipeline using the source identified by stream_name.
Definition: Factory.cpp:36
SpCandidates associated with a single data chank.