[Positioning] UserInterface: categorise options

This commit is contained in:
Matteo Cypriani 2010-03-23 14:53:37 +01:00
parent 58ed434d6b
commit 30e4e47ca8
2 changed files with 63 additions and 7 deletions

View File

@ -81,41 +81,88 @@ void UserInterface::fill_cli_options()
void UserInterface::fill_file_options()
{
file_options->add_options()
fill_server_options() ;
fill_input_options() ;
fill_log_options() ;
fill_positioning_options() ;
fill_output_options() ;
}
// Server options
void UserInterface::fill_server_options()
{
po::options_description options("Server options") ;
options.add_options()
("server.port,l", po::value<int>()
->default_value(DEFAULT_LISTENING_PORT),
"Server listening port.")
;
// Input options
file_options->add(options) ;
}
void UserInterface::fill_input_options()
{
po::options_description options("Input options") ;
options.add_options()
("input.medium,I", po::value<string>(),
"Medium from which requests are read. Allowed: CSV.")
("input.csv-file,C", po::value<string>(),
"CSV file to use for input (when input.medium = CSV).")
;
// Log options
file_options->add(options) ;
}
void UserInterface::fill_log_options()
{
po::options_description options("Log options") ;
options.add_options()
("log.medium,L", po::value< vector<string> >()->composing(),
"Medium to which the requests will be logged. You can specify \
this option more than once. Allowed: none, CSV. The `none` value \
completely disables logging.")
("log.csv-file", po::value<string>(),
"CSV file to use for logging (when log.medium = CSV).")
;
// Positioning algorithm options
file_options->add(options) ;
}
void UserInterface::fill_positioning_options()
{
po::options_description options("Positioning options") ;
options.add_options()
("positioning.algorithm,A", po::value< vector<string> >()->composing(),
"Algorithms used to compute positions. You can specify \
this option more than once (but at least once). Allowed: Real.")
;
// Output options
file_options->add(options) ;
}
void UserInterface::fill_output_options()
{
po::options_description options("Output options") ;
options.add_options()
("output.medium,O", po::value< vector<string> >()->composing(),
"Medium to which the results will be wrote. You can specify \
this option more than once. Allowed: Terminal, CSV. \
If this option is absent, results will be printed on the terminal.")
("output.csv-file", po::value<string>(),
"CSV file to use for output (when output.medium = CSV).")
;
; // End of options
file_options->add(options) ;
}

View File

@ -17,15 +17,24 @@ protected:
//@{
/// Fill in all the options
void fill_options(void) ;
/// Fill in the options accepted on the command line
void fill_cli_options(void) ;
/// \brief Fill in the options accepted on the command line and in
/// the configuration file
void fill_file_options(void) ;
void fill_server_options(void) ;
void fill_input_options(void) ;
void fill_log_options(void) ;
void fill_positioning_options(void) ;
void fill_output_options(void) ;
/// Parse all the configuration inputs and updates Configuration
void parse_options(void) ;
void parse_command_line(void) const ;
void parse_file(void) const ;
/// If help was requested by user, displays accepted options and exit
void print_usage_and_exit_if_requested(void) const ;
//@}