Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
EmulatorAppConfig.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/emulator/EmulatorAppConfig.h"
25 #include "cheetah/version.h"
26 
27 
28 namespace ska {
29 namespace cheetah {
30 namespace emulator {
31 
32 
33 EmulatorAppConfig::EmulatorAppConfig(std::string const& app_name, std::string const& description)
34  : BasicAppConfig(app_name, description)
35  , _stream_type(Stream::SkaMid)
36 {
37  add(_emulator_config);
38 }
39 
40 EmulatorAppConfig::~EmulatorAppConfig()
41 {
42 }
43 
44 ska::cheetah::emulator::Config& EmulatorAppConfig::emulator_config()
45 {
46  return _emulator_config;
47 }
48 
49 std::string EmulatorAppConfig::version() const
50 {
51  return std::string(cheetah::version) + "\n" + BasicAppConfig::version();
52 }
53 
54 void EmulatorAppConfig::add_options(OptionsDescriptionEasyInit& add_options)
55 {
56  add_options
57  ("stream", boost::program_options::value<std::string>()->default_value("ska_mid")->notifier([&](std::string const& value)
58  {
59  if(value == "ska_mid") {
60  _stream_type=Stream::SkaMid;
61  }
62  else if(value == "ska_low") {
63  _stream_type=Stream::SkaLow;
64  }
65  else {
66  throw panda::Error("unknown stream type");
67  }
68  }
69  ), "type of UDP stream to generate ska_low or ska_mid")
70  ("list-generators", boost::program_options::bool_switch()->notifier([this](bool b)
71  {
72  if(b) {
73  for(auto const& gen : _generator_keys) {
74  std::cout << "\t" << gen << "\n";
75  }
76  }
77  return false;
78  }), "display a list of generators available");
79 }
80 
81 void EmulatorAppConfig::set_generator_list(std::vector<std::string> const& generator_names)
82 {
83  _generator_keys = generator_names;
84 }
85 
86 std::vector<std::string> const& EmulatorAppConfig::generator_list() const
87 {
88  return _generator_keys;
89 }
90 
91 EmulatorAppConfig::Stream EmulatorAppConfig::stream_type() const
92 {
93  return _stream_type;
94 }
95 
96 } // namespace emulator
97 } // namespace cheetah
98 } // namespace ska
Some limits and constants for FLDO.
Definition: Brdz.h:35
Configuration options for the Emulator.
Definition: Config.h:50