Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
GeneratorFactory.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/generators/GeneratorFactory.h"
25 #include "panda/Log.h"
26 #include "panda/Error.h"
27 #include "cheetah/generators/TimeFrequencyGenerator.h"
28 #include "cheetah/generators/DispersedPulse.h"
29 #include "cheetah/generators/GaussianNoise.h"
30 #include "cheetah/generators/BasebandGaussianNoise.h"
31 #include "cheetah/generators/PulsarInjection.h"
32 #include "cheetah/generators/RfiScenario.h"
33 #include "cheetah/generators/NullGenerator.h"
34 
35 
36 namespace ska {
37 namespace cheetah {
38 namespace generators {
39 
40 
41 template<typename T>
42 GeneratorFactory<T>::GeneratorFactory(Config const& config)
43  : ska::panda::Factory<TimeFrequencyGenerator<T>>("GeneratorFactory:")
44  , _config(config)
45  , _pulsar_injection_it(config.pulsar_injection_end())
46 {
47  this->add_type("gaussian_noise", [this]() { return new GaussianNoise<T>(_config.gaussian_noise()); });
48  this->add_type("pulsar_injection", [this]() {
49  if(_pulsar_injection_it == _config.pulsar_injection_end())
50  {
51  _pulsar_injection_it = _config.pulsar_injection_begin();
52  if(_pulsar_injection_it == _config.pulsar_injection_end()) {
53  throw panda::Error("pulsar_injection requested but no corresponding configuration available");
54  }
55  }
56  return new PulsarInjection<T>(*_pulsar_injection_it++, _profile_manager);
57  }
58  );
59 
60  this->add_type("dispersed_pulse", [this]() { return new DispersedPulse<T>(_config.dispersed_pulse()); });
61  this->add_type("RfiScenario0", []() { return new RfiScenario<0, T>(); });
62  this->add_type("RfiScenario1", []() { return new RfiScenario<1, T>(); });
63  this->add_type("RfiScenario2", []() { return new RfiScenario<2, T>(); });
64  this->add_type("RfiScenario3", []() { return new RfiScenario<3, T>(); });
65  this->add_type("null", []() { return new NullGenerator<T>(); });
66 
67 }
68 
69 template<typename T>
70 GeneratorFactory<T>::~GeneratorFactory()
71 {
72 }
73 
74 } // namespace generators
75 } // namespace cheetah
76 } // namespace ska
Some limits and constants for FLDO.
Definition: Brdz.h:35