24 #include "cheetah/pipeline/PipelineHandlerFactory.h" 25 #include "cheetah/pipeline/CheetahConfig.h" 28 #include "cheetah/pipeline/Empty.h" 29 #include "cheetah/pipeline/AccelerationSearch.h" 30 #include "cheetah/pipeline/TdasAccelerationSearchTraits.h" 31 #include "cheetah/pipeline/SinglePulse.h" 32 #include "cheetah/pipeline/RfiDetectionPipeline.h" 34 #include "panda/Error.h" 35 #include "panda/MixInTimer.h" 38 #include <type_traits> 44 template<
typename T,
typename NumericalT>
46 T* make_handler(CheetahConfig<NumericalT>
const& config, BeamConfig<NumericalT>
const& beam_config) {
47 return new T(config, beam_config);
51 template<
typename NumericalT,
typename Base>
55 template<
typename... Args>
57 : Base(config, std::forward<Args>(args)...)
72 template<
typename NumericalT,
typename Base>
78 template<
typename... Args>
80 : BaseT(std::forward<Args>(args)...)
86 template<
typename NumericalT>
89 typedef std::chrono::high_resolution_clock ClockType;
94 : BaseT(config, beam_config)
107 auto start=ClockType::now();
109 auto end=ClockType::now();
110 PANDA_LOG <<
"timing: " << std::chrono::duration_cast<std::chrono::microseconds>(start - end).count() <<
"microseconds";
117 template<
typename NumericalT>
127 #define REGISTER_HANDLER(handler_name) \ 128 add_type(#handler_name, make_handler<handler_name<NumericalT>, NumericalT>) 134 REGISTER_HANDLER(
Empty);
135 REGISTER_HANDLER(
Tdas);
142 PipelineHandlerFactory::~PipelineHandlerFactory()
146 template<
typename TypeFactory>
147 void PipelineHandlerFactory::add_factory(std::string
const& handler_name, TypeFactory
const& factory)
149 typedef typename std::remove_pointer<decltype(std::declval<TypeFactory>()(_config, std::declval<
BeamConfig<NumericalT> const&>()))>::type Type;
150 _map.insert( std::make_pair( handler_name
153 return factory(config, beam_config);
157 _timed_map.insert( std::make_pair( handler_name
160 auto handler = factory(config, beam_config);
171 template<
typename TypeFactory>
172 void PipelineHandlerFactory::add_type(std::string
const& handler_name, TypeFactory )
174 _types.push_back(handler_name);
177 typedef typename std::remove_pointer<decltype(std::declval<TypeFactory>()(_config, std::declval<
BeamConfig<NumericalT> const&>()))>::type Type;
189 auto it = _map.find(handler_name);
191 throw panda::Error(
"Pipeline handler '" + handler_name +
"' unknown");
193 return it->second(_config, beam_config);
198 auto it = _timed_map.find(handler_name);
199 if(it == _timed_map.end())
200 throw panda::Error(
"Pipeline handler '" + handler_name +
"' unknown");
202 return it->second(_config, beam_config);
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 ...
The acceleration search pipeline.
std::vector< std::string > available() const
return a vector of available pipeline
Some limits and constants for FLDO.
PoolManagerType const & pool_manager() const
return the pool manager object
Parse configuration parameters for a single beam in the pipeline instance of cheetah.
Base class for Cheetah Pipeline Handlers.
HandlerType * create(std::string const &type, BeamConfig< NumericalT > const &) const
create a handler of the named type
A Single Pulse Search Pipeline.
void set_pipeline_handlers(std::vector< std::string > const &handler_names)
set the computational unit names available
Pipeline that performs only RFI detection.