Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
Public Types | Public Member Functions | Protected Member Functions | List of all members
ska::cheetah::pipeline::CheetahConfig< NumericalRep > Class Template Reference

Parse configuration parameters for a cheetah pipeline application. More...

#include <cheetah/pipeline/CheetahConfig.h>

Inheritance diagram for ska::cheetah::pipeline::CheetahConfig< NumericalRep >:
Inheritance graph
Collaboration diagram for ska::cheetah::pipeline::CheetahConfig< NumericalRep >:
Collaboration graph

Public Types

typedef utils::Config::PoolManagerType PoolManagerType
 
- Public Types inherited from ska::cheetah::utils::Config
typedef System SystemType
 
typedef panda::PoolManager< SystemTypePoolManagerType
 
typedef PoolManagerType::PoolType PoolType
 

Public Member Functions

 CheetahConfig (std::string const &app_name="cheetah")
 
std::string version () const
 return the cheetah version as a string
 
std::string const & stream_name () const
 return the selected stream name
 
bool time_handler_invocation () const
 wether to activte timing between each invocation of the runtime computational pipeline
 
std::string const & pipeline_name () const
 return the selected pipeline name
 
void set_pipeline_handlers (std::vector< std::string > const &handler_names)
 set the computational unit names available
 
AccelerationSearchAlgoConfigacceleration_search_config ()
 return the templated acceleration search configuration
 
AccelerationSearchAlgoConfig const & acceleration_search_config () const
 
MultiBeamConfig< NumericalRep > const & beams_config () const
 return the configuration node with beam configurations
 
channel_mask::ConfigurableChannelMaskConfig< NumericalRep > const & channel_mask_config () const
 return the channel_mask configuration
 
channel_mask::ConfigurableChannelMaskConfig< NumericalRep > & channel_mask_config ()
 
fldo::ConfigType const & fldo_config () const
 return the fldo module specific configuration parameters
 
fldo::ConfigType & fldo_config ()
 
psbc::Config const & psbc_config () const
 return the psbc module specific configuration parameters
 
psbc::Configpsbc_config ()
 
rfim::ConfigType< PoolManagerType > const & rfim_config () const
 return the rfim module specific configuration parameters
 
sps::ConfigType< PoolManagerType > const & sps_config () const
 return the sps module specific configuration parameters
 
sps::ConfigType< PoolManagerType > & sps_config ()
 
spsift::Config const & spsift_config () const
 
sps_clustering::Config const & sps_clustering_config () const
 
sift::ConfigType const & sift_config () const
 return the sift module specific configuration parameters
 
sift::ConfigType & sift_config ()
 
panda::DataSwitchConfig & switch_config () const
 return the data switch configuration parameters
 
panda::PoolManagerConfig< utils::Config::SystemType > const & pool_manager_config () const
 return the data switch configuration parameters
 
PoolManagerType const & pool_manager () const
 return the pool manager object
 
PoolManagerType & pool_manager ()
 
EmptyConfig const & empty_config () const
 return the empty module specific configuration parameters
 
ScanConfig const & scan_config () const
 return the empty module specific configuration parameters
 
int parse (int argc, char **argv)
 parse the command line options/config file More...
 
- Public Member Functions inherited from ska::cheetah::utils::Config
 Config (std::string module_name)
 
void terminate () const
 call for notifiers to indicate a termination condition More...
 

Protected Member Functions

void add_options (OptionsDescriptionEasyInit &add_options) override
 

Detailed Description

template<typename NumericalRep>
class ska::cheetah::pipeline::CheetahConfig< NumericalRep >

Parse configuration parameters for a cheetah pipeline application.

Definition at line 67 of file CheetahConfig.h.

Member Function Documentation

◆ parse()

template<typename NumericalRep >
int ska::cheetah::pipeline::CheetahConfig< NumericalRep >::parse ( int  argc,
char **  argv 
)

parse the command line options/config file

Returns
0 to indicate no parse halting options specified
>0 to indicate parse failed or parse indicates program halt

Definition at line 157 of file CheetahConfig.cpp.

158 {
159  if(argc > 0) _app_name= boost::filesystem::basename(argv[0]);
160 
161  // parse the command line
162  boost::program_options::variables_map vm;
163  boost::program_options::store(boost::program_options::command_line_parser(argc, argv)
164  .options(_all_desc)
165  .positional(_options_pod)
166  .run(), vm);
167 
168  if( vm.count("version") ) {
169  std::cout << version() << "\n";
170  return 1;
171  }
172  if( vm.count("help") ) {
173  std::cout << "Name\n\t" << _app_name << " - cheetah pipeline launcher\n\n";
174  std::cout << "Synopsis\n\t" << _app_name << " [OPTIONS] [config_file]\n\n";
175  std::cout << "\tA source and a pipeline must be specfied as a minimum, either through the" << "\n";
176  std::cout << "\toptions or through the config file (--help-config-file).\n" << "\n";
177  std::cout << "\tModule specific help can be accessed via the --help-module flag.\n" << "\n";
178  std::cout << _desc << "\n";
179  return 1;
180  }
181  if( vm.count("help-config-file") ) {
182  std::cout << "Name\n\t" << _app_name << " - cheetah pipeline launcher config files\n\n";
183  std::cout << "Description\n\tconfig files should be in XML format and the filename should have the .xml extension." << "\n";
184  std::cout << "\tAny command line option can be set in the config file using the long name of the option as a tag." << "\n";
185  std::cout << "\tAll tags must be enclosed in the <cheetah> tag scope.\n" << "\n";
186  boost::property_tree::ptree cheetah_config_pt;
187  cheetah_config_pt.put_child("cheetah", config_tree());
188 #if BOOST_VERSION < 105600
189  boost::property_tree::write_xml(std::cout, cheetah_config_pt,boost::property_tree::xml_writer_make_settings(' ', 2));
190 #else
191  boost::property_tree::write_xml(std::cout, cheetah_config_pt,boost::property_tree::xml_writer_make_settings<std::string>(' ', 2));
192 #endif
193  std::cout << "\n";
194  return 1;
195  }
196  if( vm.count("list-modules") ) {
197  for( auto const& mod : subsections() ) {
198  std::cout << mod << "\n";
199  }
200  return 1;
201  }
202  if( vm.count("list-sources") ) {
203  // list the streams
204  std::vector<std::string> s {"sigproc", "udp", "udp_low"};
205 #ifdef ENABLE_PSRDADA
206  s.push_back("psrdada");
207 #endif // ENABLE_PSRDADA
208  for( auto stream : s ) {
209  std::cout << stream << "\n";
210  }
211  return 1;
212  }
213  if( vm.count("list-pipelines") ) {
214  // list the pipelines
215  for( auto pipeline : _pipeline_handler_names ) {
216  std::cout << pipeline << "\n";
217  }
218  return 1;
219  }
220  if( vm.count("config") ) {
221  // configuration file specified
222  panda::ConfigFile config_file(vm["config"].as<std::string>());
223  try {
224  config_file.parse();
225  } catch(std::exception const& e) {
226  PANDA_LOG_ERROR << "exception parsing config file: " << vm["config"].as<std::string>() << " " << e.what();;
227  throw;
228  } catch(...) {
229  PANDA_LOG_ERROR << "exception parsing config file: " << vm["config"].as<std::string>();
230  throw;
231  }
232  // <cheetah> section corresponds to generic options
233  auto top_it = config_file.property_tree().find("cheetah");
234  if(top_it != config_file.property_tree().not_found() ) {
235  boost::program_options::store(panda::parse_property_tree<char>(top_it->second, _desc), vm);
236  parse_property_tree(top_it->second, vm);
237  }
238  }
239  // n/b must come after config file to pick up dynamic options
240  if( vm.count("help-module") ) {
241  for(auto const& module : vm["help-module"].as<std::vector<std::string>>() ) {
242  std::cout << "Name\n\t" << _app_name << " - cheetah pipeline launcher module : " << module << "\n\n";
243  std::cout << help(module) << "\n";
244  }
245  return 1;
246  }
247  if( vm.count("input-stream") ) {
248  _stream_name = vm["input-stream"].as<std::string>();
249  }
250  if( vm.count("timer") ) {
251  _handler_timing = true;
252  }
253 
254  boost::program_options::notify(vm);
255 
256  return 0;
257 }
std::string version() const
return the cheetah version as a string

The documentation for this class was generated from the following files: