1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
6 #include "config/i2-config.hpp"
7 #include "config/expression.hpp"
8 #include "base/debuginfo.hpp"
19 typedef std::map<String, std::vector<String> > TypeMap;
20 typedef std::map<String, std::vector<ApplyRule> > RuleMap;
22 String GetTargetType() const;
23 String GetName() const;
24 Expression::Ptr GetExpression() const;
25 Expression::Ptr GetFilter() const;
26 String GetPackage() const;
27 String GetFKVar() const;
28 String GetFVVar() const;
29 Expression::Ptr GetFTerm() const;
30 bool GetIgnoreOnError() const;
31 DebugInfo GetDebugInfo() const;
32 Dictionary::Ptr GetScope() const;
34 bool HasMatches() const;
36 bool EvaluateFilter(ScriptFrame& frame) const;
38 static void AddRule(const String& sourceType, const String& targetType, const String& name, const Expression::Ptr& expression,
39 const Expression::Ptr& filter, const String& package, const String& fkvar, const String& fvvar, const Expression::Ptr& fterm,
40 bool ignoreOnError, const DebugInfo& di, const Dictionary::Ptr& scope);
41 static std::vector<ApplyRule>& GetRules(const String& type);
43 static void RegisterType(const String& sourceType, const std::vector<String>& targetTypes);
44 static bool IsValidSourceType(const String& sourceType);
45 static bool IsValidTargetType(const String& sourceType, const String& targetType);
46 static std::vector<String> GetTargetTypes(const String& sourceType);
48 static void CheckMatches(bool silent);
53 Expression::Ptr m_Expression;
54 Expression::Ptr m_Filter;
58 Expression::Ptr m_FTerm;
60 DebugInfo m_DebugInfo;
61 Dictionary::Ptr m_Scope;
64 static TypeMap m_Types;
65 static RuleMap m_Rules;
67 ApplyRule(String targetType, String name, Expression::Ptr expression,
68 Expression::Ptr filter, String package, String fkvar, String fvvar, Expression::Ptr fterm,
69 bool ignoreOnError, DebugInfo di, Dictionary::Ptr scope);
74 #endif /* APPLYRULE_H */