#ifndef DOMAIN_RULE_H #define DOMAIN_RULE_H #include "address_space.h" #include "value.h" #include "function_signature.h" #include #include #include #include namespace domain { struct RuleContext { std::map addressSpaces; std::map attributes; std::map function; }; class Condition { bool negated; std::string function; std::vector params; public: Condition(std::string function, std::vector params, bool negated); bool evaluate(RuleContext &context); }; class Action { public: enum ActionType { ERROR, WARNING }; private: ActionType type; std::string message; public: Action(ActionType type, std::string message); ActionType getType(); std::string getMessage(); }; class IfStatement { Condition condition; Action action; public: IfStatement(Condition condition, Action action); std::optional evaluate(RuleContext &context); }; class Rule { std::vector statements; public: explicit Rule(std::vector statements); std::optional evaluate(RuleContext &context); }; } // namespace domain #endif // DOMAIN_RULE_H