From 91dcfb400ebf1fa3f291a15e90fd720f66e5a59b Mon Sep 17 00:00:00 2001 From: Thomas Knoll Date: Wed, 10 Jan 2024 23:13:23 +0100 Subject: [PATCH] renamed action to command --- util/ConfigYaml.cpp | 22 +++++++++++----------- util/ConfigYaml.h | 12 ++++++------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/util/ConfigYaml.cpp b/util/ConfigYaml.cpp index 3a62b37..7dc392c 100644 --- a/util/ConfigYaml.cpp +++ b/util/ConfigYaml.cpp @@ -11,8 +11,8 @@ std::ostream& operator << (std::ostream &os, const Formula& formula) { return os; } -std::ostream& operator << (std::ostream& os, const Action& action) { - os << action.action_; +std::ostream& operator << (std::ostream& os, const Command& command) { + os << command.action_; return os; } @@ -23,8 +23,8 @@ std::ostream& operator << (std::ostream& os, const Constant& constant) { std::ostream& operator << (std::ostream& os, const Module& module) { os << "Module: " << module.module_ << std::endl; - for (auto& action : module.actions_) { - os << action << std::endl; + for (auto& command : module.commands_) { + os << command << std::endl; } return os; } @@ -45,7 +45,7 @@ std::string Formula::createExpression() const { return "formula " + formula_ + " = " + content_ + Configuration::configuration_identifier_; } -std::string Action::createExpression() const { +std::string Command::createExpression() const { if (overwrite_) { return action_ + "\t" + guard_ + "-> " + update_ + Configuration::overwrite_identifier_; } @@ -65,7 +65,7 @@ YAML::Node YAML::convert::encode(const Module& rhs) { YAML::Node node; node.push_back(rhs.module_); - node.push_back(rhs.actions_); + node.push_back(rhs.commands_); return node; } @@ -74,12 +74,12 @@ bool YAML::convert::decode(const YAML::Node& node, Module& rhs) { if (!node.Type() == NodeType::Map) { return false; } - rhs.actions_ = node["actions"].as>(); + rhs.commands_ = node["commands"].as>(); rhs.module_ = node["module"].as(); return true; } -YAML::Node YAML::convert::encode(const Action& rhs) { +YAML::Node YAML::convert::encode(const Command& rhs) { YAML::Node node; node.push_back(rhs.action_); @@ -90,7 +90,7 @@ YAML::Node YAML::convert::encode(const Action& rhs) { return node; } -bool YAML::convert::decode(const YAML::Node& node, Action& rhs) { +bool YAML::convert::decode(const YAML::Node& node, Command& rhs) { if (!node.Type() == NodeType::Map) { return false; } @@ -244,8 +244,8 @@ YamlConfigParseResult YamlConfigParser::parseConfiguration() { configuration.push_back({formula.createExpression(), formula.formula_ ,ConfigType::Formula, formula.overwrite_}); } for (auto& module : modules) { - for (auto& action : module.actions_) { - configuration.push_back({action.createExpression(), action.action_, ConfigType::Module, action.overwrite_, module.module_, action.index_}); + for (auto& command : module.commands_) { + configuration.push_back({command.createExpression(), command.action_, ConfigType::Module, command.overwrite_, module.module_, command.index_}); } } for (auto& constant : constants) { diff --git a/util/ConfigYaml.h b/util/ConfigYaml.h index 1b28eda..ccaa34c 100644 --- a/util/ConfigYaml.h +++ b/util/ConfigYaml.h @@ -95,7 +95,7 @@ struct Formula { friend std::ostream& operator << (std::ostream &os, const Formula& formula); }; -struct Action { +struct Command { public: std::string action_; std::string guard_; @@ -105,13 +105,13 @@ struct Action { std::string createExpression() const; - friend std::ostream& operator << (std::ostream& os, const Action& action); + friend std::ostream& operator << (std::ostream& os, const Command& command); }; struct Module { public: - std::vector actions_; + std::vector commands_; std::string module_; friend std::ostream& operator << (std::ostream& os, const Module& module); @@ -125,9 +125,9 @@ struct YAML::convert { }; template<> -struct YAML::convert { - static YAML::Node encode(const Action& rhs); - static bool decode(const YAML::Node& node, Action& rhs); +struct YAML::convert { + static YAML::Node encode(const Command& rhs); + static bool decode(const YAML::Node& node, Command& rhs); };