Commit b51ffc69 authored by Kučera Petr RNDr. Ph.D.'s avatar Kučera Petr RNDr. Ph.D.
Browse files

verbosity managed by PrgOptions

parent f091c5fb
......@@ -47,7 +47,6 @@ struct config_t
std::string input_file{};
std::string output_file{};
PROCESS process{PROCESS::PRIME};
unsigned verbosity{3};
};
std::optional<config_t>
......@@ -57,7 +56,7 @@ parse_arguments(int argc, char *argv[])
auto opt_process = SUBool::make_enum_option(kProcessAnnotation, "process,p",
"Clause inprocessing and preprocessing level.", conf.process);
std::string process;
SUBool::PrgOptions opts(conf.verbosity);
SUBool::PrgOptions opts;
opts.InputOutput(conf.input_file, conf.output_file);
po::options_description desc("Configuration options");
desc.add(opt_process);
......@@ -79,7 +78,8 @@ dump_config(const config_t &conf, unsigned level)
SUBool::logs.TLog(level)
<< "\tprocess: " << process_names.at(static_cast<unsigned>(conf.process))
<< std::endl;
SUBool::logs.TLog(level) << "\tverbosity: " << conf.verbosity << std::endl;
SUBool::logs.TLog(level)
<< "\tverbosity: " << SUBool::logs.mVerbLevel << std::endl;
}
int
......@@ -154,7 +154,6 @@ main(int argc, char *argv[])
{
return 1;
}
SUBool::logs.mVerbLevel = conf->verbosity;
dump_config(*conf, 1);
SUBool::CNF cnf;
int ret = input(*conf, &cnf);
......
......@@ -54,7 +54,6 @@ struct config_t
{
std::string file_left{};
std::string file_right{};
unsigned verbosity{3}; // 0 means no output
RELATION relation{RELATION::EQUAL};
COMPARE_KIND compare_kind{COMPARE_KIND::IMPLICATE};
};
......@@ -65,7 +64,8 @@ dump_config(const config_t &conf, unsigned level)
SUBool::logs.TLog(level) << "Configuration:" << std::endl;
SUBool::logs.TLog(level) << "\tfile_left: " << conf.file_left << std::endl;
SUBool::logs.TLog(level) << "\tfile_right: " << conf.file_right << std::endl;
SUBool::logs.TLog(level) << "\tverbosity: " << conf.verbosity << std::endl;
SUBool::logs.TLog(level)
<< "\tverbosity: " << SUBool::logs.mVerbLevel << std::endl;
kRelationAnnotation.DumpValue("\t", level, "relation", conf.relation);
kCompareKindAnnotation.DumpValue(
"\t", level, "compare_kind", conf.compare_kind);
......@@ -81,7 +81,7 @@ parse_arguments(int argc, char *argv[])
"compare-kind,k", "How the CNFs should be compared.", conf.compare_kind);
// options.positional_help("[input-left [input-right]]");
SUBool::PrgOptions opts(conf.verbosity);
SUBool::PrgOptions opts;
opts.InputPair(
{&conf.file_left, "input-left"}, {&conf.file_right, "input-right"});
po::options_description desc("Configuration options");
......@@ -300,7 +300,6 @@ main(int argc, char *argv[])
{
return 1;
}
SUBool::logs.mVerbLevel = conf->verbosity;
dump_config(*conf, 0);
auto left_cnf =
SUBool::input_or_die<SUBool::CNF>(conf->file_left, SUBool::logs);
......
......@@ -98,6 +98,7 @@ SUBool::PrgOptions::ProcessCommon() const
Version();
return false;
}
logs.mVerbLevel = mVerbosity;
return true;
}
......
......@@ -138,7 +138,7 @@ namespace SUBool
std::string mPrgHelpDesc{};
std::string mPositionalHelp{};
bool mUseConfigFile{false};
unsigned &mVerbosity;
unsigned mVerbosity{LogStream::kDefaultLogLevel};
std::string mConfigFile{};
po::options_description mCommon{};
......@@ -160,13 +160,11 @@ namespace SUBool
inline static const std::string kCommonOptsLabel = "Common options";
inline static const std::string kInputOutputHelp = "[input [output]]";
inline static const std::string kCfgSuffix = ".cfg";
static const unsigned kDefaultVerbosity = 3;
PrgOptions(unsigned &verbosity, bool use_config_file = false,
PrgOptions(bool use_config_file = false,
const std::string &common_opts_label = kCommonOptsLabel)
: mPrgName(kPrgName), mPrgDesc(kPrgDesc),
mUseConfigFile(use_config_file), mVerbosity(verbosity),
mCommon(common_opts_label)
mUseConfigFile(use_config_file), mCommon(common_opts_label)
{
InitCommon();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment