12 using namespace filesystem;
14 ConfigData::ConfigData(
string& algorithm_name,
const string& mask_name,
bool use_frequencies) : algorithm_name_{ algorithm_name }, mask_name_{ mask_name } {
17 config = YAML::LoadFile(config_file_);
20 cout <<
"ERROR: Unable to read configuration file '" << config_file_ <<
"'.\n";
24 if (config[
"paths"][
"input"]) {
25 global_input_path_ = path(config[
"paths"][
"input"].as<string>());
26 if (config[
"datasets"]) {
27 datasets_ = config[
"datasets"].as<vector<string>>();
28 datasets_path_.resize(datasets_.size());
29 generate(datasets_path_.begin(), datasets_path_.end(), [
this, datasets_it = datasets_.begin()]()
mutable { return global_input_path_ / path(*datasets_it++); });
33 if (use_frequencies) {
34 UpdateAlgoNameWithDatasets();
35 algorithm_name = algorithm_name_;
38 if (config[
"paths"][
"output"]) {
40 global_output_path_ = path(config[
"paths"][
"output"].as<string>());
41 algorithm_output_path_ = global_output_path_ / path(algorithm_name);
42 create_directories(algorithm_output_path_);
45 odt_path_ = algorithm_output_path_ / path(algorithm_name + odt_suffix_);
48 code_path_ = algorithm_output_path_ / path(algorithm_name + code_suffix_);
51 rstable_path_ = algorithm_output_path_ / path(algorithm_name + rstable_suffix_);
54 treecode_path_ = algorithm_output_path_ / path(algorithm_name + treecode_suffix_);
55 forestcode_path_ = algorithm_output_path_ / path(algorithm_name + forestcode_suffix_);
56 treedagcode_path_ = algorithm_output_path_ / path(algorithm_name + treedagcode_suffix_);
57 forestdagcode_path_ = algorithm_output_path_ / path(algorithm_name + forestdagcode_suffix_);
60 frequencies_path_ = global_output_path_ / frequencies_local_path_;
61 create_directories(frequencies_path_ / mask_name_);
64 chaincode_rstable_path_ = global_output_path_ / path(chaincode_rstable_filename_);
67 ctbe_rstable_path_ = global_output_path_ / path(ctbe_rstable_filename_);
70 cout <<
"ERROR: missing output path in configuration file.\n";
74 if (config[
"dot"][
"background"]) {
75 dot_background_color_ =
"\"" + config[
"dot"][
"background"].as<
string>() +
"\"";
78 cout <<
"WARNING: missing dot background color, " + dot_background_color_ +
" will be used.\n";
81 if (config[
"dot"][
"ranksep"]) {
82 dot_ranksep_ = config[
"dot"][
"ranksep"].as<std::string>();
85 std::cout <<
"WARNING: missing dot ranksep, " + dot_ranksep_ +
" will be used.\n";
88 if (config[
"dot"][
"out_format"]) {
89 dot_output_format_ =
"." + config[
"dot"][
"out_format"].as<
string>();
92 cout <<
"WARNING: missing output file format, 'pdf' will be used.\n";
95 if (config[
"force_odt_generation"]) {
96 force_odt_generation_ = config[
"force_odt_generation"].as<
bool>();