Allow EvaluateRules() to keep rules for the next iteration.

Refs #6105
This commit is contained in:
Michael Friedrich 2014-05-02 00:23:29 +02:00
parent b268e7d32d
commit e04d200d36
5 changed files with 11 additions and 9 deletions

View File

@ -75,7 +75,7 @@ bool ApplyRule::EvaluateFilter(const Dictionary::Ptr& scope) const
return result;
}
void ApplyRule::EvaluateRules(void)
void ApplyRule::EvaluateRules(bool clear)
{
std::set<String> completedTypes;
@ -113,7 +113,8 @@ void ApplyRule::EvaluateRules(void)
}
}
m_Rules.clear();
if (clear)
m_Rules.clear();
}
void ApplyRule::RegisterType(const String& sourceType, const std::vector<String>& targetTypes, const ApplyRule::Callback& callback)

View File

@ -49,7 +49,7 @@ public:
static void AddRule(const String& sourceType, const String& targetType, const String& name, const AExpression::Ptr& expression,
const AExpression::Ptr& filter, const DebugInfo& di, const Dictionary::Ptr& scope);
static void EvaluateRules(void);
static void EvaluateRules(bool clear);
static void RegisterType(const String& sourceType, const std::vector<String>& targetTypes, const ApplyRule::Callback& callback);
static bool IsValidSourceType(const String& sourceType);

View File

@ -317,13 +317,13 @@ bool ConfigItem::ValidateItems(void)
upq.Join();
Log(LogInformation, "config", "Evaluating 'object' rules (step 1)...");
ObjectRule::EvaluateRules();
ObjectRule::EvaluateRules(false);
Log(LogInformation, "config", "Evaluating 'apply' rules...");
ApplyRule::EvaluateRules();
ApplyRule::EvaluateRules(true);
Log(LogInformation, "config", "Evaluating 'object' rules (step 2)...");
ObjectRule::EvaluateRules();
ObjectRule::EvaluateRules(true);
Log(LogInformation, "config", "Validating config items (step 2)...");

View File

@ -70,7 +70,7 @@ bool ObjectRule::EvaluateFilter(const Dictionary::Ptr& scope) const
return result;
}
void ObjectRule::EvaluateRules(void)
void ObjectRule::EvaluateRules(bool clear)
{
std::pair<String, Callback> kv;
BOOST_FOREACH(kv, m_Callbacks) {
@ -84,7 +84,8 @@ void ObjectRule::EvaluateRules(void)
callback(it->second);
}
m_Rules.clear();
if (clear)
m_Rules.clear();
}
void ObjectRule::RegisterType(const String& sourceType, const ObjectRule::Callback& callback)

View File

@ -48,7 +48,7 @@ public:
static void AddRule(const String& sourceType, const String& name, const AExpression::Ptr& expression,
const AExpression::Ptr& filter, const DebugInfo& di, const Dictionary::Ptr& scope);
static void EvaluateRules(void);
static void EvaluateRules(bool clear);
static void RegisterType(const String& sourceType, const ObjectRule::Callback& callback);
static bool IsValidSourceType(const String& sourceType);