Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
PhaseModelFactory.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/PhaseModelFactory.h"
25 #include "cheetah/generators/src/SimplePhaseModel.h"
26 #include "cheetah/generators/src/Tempo2PhaseModel.h"
27 #include "cheetah/generators/PulsarInjectionConfig.h"
28 #include <panda/Error.h>
29 
30 namespace ska {
31 namespace cheetah {
32 namespace generators {
33 
34 
35 PhaseModelFactory::PhaseModelFactory(ConfigType const& config)
36  : _iterators(config)
37  , _types({"simple", "tempo2"})
38 {
39 }
40 
41 PhaseModelFactory::~PhaseModelFactory()
42 {
43 }
44 
45 PhaseModelFactory::type PhaseModelFactory::create(std::string const& type) const
46 {
47  if(type=="simple") {
48  return SimplePhaseModel(static_cast<SimplePhaseModelConfig const&>(_iterators.config("simple_phase_model")));
49  }
50  else if(type=="tempo2") {
51  return Tempo2PhaseModel(static_cast<Tempo2PhaseModelConfig const&>(_iterators.config("tempo2_phase_model")));
52  }
53  else {
54  panda::Error e("phase_model: unknown phase model type requested:");
55  e << type;
56  throw e;
57  }
58 }
59 
60 std::vector<std::string> const& PhaseModelFactory::types() const
61 {
62  return _types;
63 }
64 } // namespace generators
65 } // namespace cheetah
66 } // namespace ska
A simple Taylor Expansion phase model.
std::vector< std::string > const & types() const
return the types supported
Some limits and constants for FLDO.
Definition: Brdz.h:35
type create(std::string const &type) const
creates a phase model of the specified type, using the next available suitable configuration that is ...
Parameters for specifying the tempo2 phase model.