7 #ifndef GRAPHGEN_BASE_RULESET_H_
8 #define GRAPHGEN_BASE_RULESET_H_
15 #include "yaml-cpp/yaml.h"
27 std::filesystem::path p_;
28 bool force_generation_;
29 bool disable_generation_;
39 rs_node = YAML::LoadFile(p_.string());
53 std::ofstream os(p_.string());
56 YAML::Emitter emitter(os);
57 emitter.SetSeqFormat(YAML::EMITTER_MANIP::Flow);
64 BaseRuleSet(
bool force_generation =
false) : force_generation_{ force_generation }, disable_generation_{ false }
69 BaseRuleSet(std::filesystem::path custom_path) : force_generation_{ false }, disable_generation_{ true }, p_{ custom_path }
74 if (force_generation_ || !LoadRuleSet()) {
75 if (disable_generation_) {
76 auto msg =
"Could not load rule set " + p_.string() +
" from file (generation disabled).\n";
78 throw std::runtime_error((msg).c_str());
Is the base class for the RuleSet from which every user-defined RuleSet should inherit.
BaseRuleSet(std::filesystem::path custom_path)
BaseRuleSet(bool force_generation=false)
virtual rule_set GenerateRuleSet()=0
std::filesystem::path rstable_path_
YAML::Node Serialize() const