Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
PipelineHandlerFactory.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_PIPELINEHANDLERFACTORY_H
25 #define SKA_CHEETAH_PIPELINE_PIPELINEHANDLERFACTORY_H
26 
27 #include "cheetah/pipeline/PipelineHandler.h"
28 #include <map>
29 #include <vector>
30 #include <functional>
31 #include "cheetah/data/TimeFrequency.h"
32 
33 namespace ska {
34 namespace cheetah {
35 namespace pipeline {
36 
37 template<typename NumericalT>
38 class CheetahConfig;
39 
40 template<typename NumericalT>
41 class BeamConfig;
42 
51 {
52  public:
53  //typedef std::function<void(data::TimeFrequency&)> HandlerType;
54  typedef uint8_t NumericalT;
56 
57  private:
58  typedef std::function<HandlerType*(CheetahConfig<NumericalT> const&, BeamConfig<NumericalT> const&)> FactoryType;
59 
60  public:
63 
67  std::vector<std::string> available() const;
68 
72  HandlerType* create(std::string const& type, BeamConfig<NumericalT> const&) const;
73 
77  HandlerType* create_timed(std::string const& type, BeamConfig<NumericalT> const&) const;
78 
79  private:
85  template<typename TypeFactory>
86  void add_type(std::string const& handler_name, TypeFactory factory);
87 
88  template<typename TypeFactory>
89  void add_factory(std::string const& handler_name, TypeFactory const& factory);
90 
91  private:
92  CheetahConfig<NumericalT> const& _config;
93  std::map<std::string, FactoryType> _map;
94  std::map<std::string, FactoryType> _timed_map;
95  std::vector<std::string> _types;
96 };
97 
98 } // namespace pipeline
99 } // namespace cheetah
100 } // namespace ska
101 
102 #endif // SKA_CHEETAH_PIPELINE_PIPELINEHANDLERFACTORY_H
HandlerType * create_timed(std::string const &type, BeamConfig< NumericalT > const &) const
create a handler of the named type with a MixInTimer to record the time of each invocation ...
std::vector< std::string > available() const
return a vector of available pipeline
Some limits and constants for FLDO.
Definition: Brdz.h:35
Parse configuration parameters for a single beam in the pipeline instance of cheetah.
Definition: BeamConfig.h:48
Base class for Cheetah Pipeline Handlers.
Definition: Pipeline.h:37
Generates pipeline handler objects by name.
HandlerType * create(std::string const &type, BeamConfig< NumericalT > const &) const
create a handler of the named type