[Positioning] owlps-positioning is almost usable
Add Positioning creation in owlps-positioning, so the program is usable, configuration is checked in Positioning, Input and Output, and objects are created and run normally. UserInterface: Minor modification, config_file_name is not initialised in constructor anymore, it is now a default value of the configuration entry "config-file".
This commit is contained in:
parent
454579d9b7
commit
7bd6f8b261
|
@ -1,4 +1,6 @@
|
||||||
#include "userinterface.hh"
|
#include "userinterface.hh"
|
||||||
|
#include "stock.hh"
|
||||||
|
#include "positioning.hh"
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
@ -6,5 +8,8 @@ int main(int argc, char **argv)
|
||||||
UserInterface *ui = new UserInterface(argc, argv) ;
|
UserInterface *ui = new UserInterface(argc, argv) ;
|
||||||
delete ui ; // We don't need it any more
|
delete ui ; // We don't need it any more
|
||||||
|
|
||||||
|
Positioning positioning ;
|
||||||
|
|
||||||
|
Stock::clear() ;
|
||||||
return 0 ;
|
return 0 ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ UserInterface::UserInterface(const int argc, char **argv)
|
||||||
assert(argv) ;
|
assert(argv) ;
|
||||||
cli_argument_values = argv ;
|
cli_argument_values = argv ;
|
||||||
cli_argument_count = argc ;
|
cli_argument_count = argc ;
|
||||||
config_file_name = DEFAULT_CONFIG_FILE_NAME ;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -73,7 +72,8 @@ void UserInterface::fill_cli_options()
|
||||||
{
|
{
|
||||||
cli_options->add_options()
|
cli_options->add_options()
|
||||||
("help,h", "Print help")
|
("help,h", "Print help")
|
||||||
("config-file,f", po::value<string>(),
|
("config-file,f", po::value<string>()
|
||||||
|
->default_value(DEFAULT_CONFIG_FILE_NAME),
|
||||||
"Alternative configuration file")
|
"Alternative configuration file")
|
||||||
; // End of options
|
; // End of options
|
||||||
}
|
}
|
||||||
|
@ -122,10 +122,6 @@ void UserInterface::parse_options()
|
||||||
parse_command_line() ;
|
parse_command_line() ;
|
||||||
print_usage_and_exit_if_requested() ;
|
print_usage_and_exit_if_requested() ;
|
||||||
|
|
||||||
// Was the config file name specified on the command line?
|
|
||||||
if (Configuration::is_configured("config-file"))
|
|
||||||
config_file_name = Configuration::string_value("config-file") ;
|
|
||||||
|
|
||||||
parse_file() ;
|
parse_file() ;
|
||||||
|
|
||||||
po::notify(Configuration::getw_configuration()) ;
|
po::notify(Configuration::getw_configuration()) ;
|
||||||
|
@ -153,6 +149,7 @@ void UserInterface::print_usage_and_exit_if_requested() const
|
||||||
|
|
||||||
void UserInterface::parse_file() const
|
void UserInterface::parse_file() const
|
||||||
{
|
{
|
||||||
|
string config_file_name = Configuration::string_value("config-file") ;
|
||||||
ifstream config_file(config_file_name.c_str()) ;
|
ifstream config_file(config_file_name.c_str()) ;
|
||||||
|
|
||||||
if (! config_file)
|
if (! config_file)
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
class UserInterface
|
class UserInterface
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
std::string config_file_name ;
|
|
||||||
int cli_argument_count ;
|
int cli_argument_count ;
|
||||||
char **cli_argument_values ;
|
char **cli_argument_values ;
|
||||||
boost::program_options::options_description *cli_options ;
|
boost::program_options::options_description *cli_options ;
|
||||||
|
|
Loading…
Reference in New Issue