mirror of https://github.com/Icinga/icinga2.git
parent
885e7704a2
commit
e3c5063aff
|
@ -536,7 +536,8 @@ Value Expression::OpObject(const Expression* expr, const Object::Ptr& context, D
|
||||||
item->SetZone(zone);
|
item->SetZone(zone);
|
||||||
item->Compile()->Register();
|
item->Compile()->Register();
|
||||||
|
|
||||||
ObjectRule::AddRule(type, name, exprl, filter, expr->m_DebugInfo, context);
|
if (ObjectRule::IsValidSourceType(type))
|
||||||
|
ObjectRule::AddRule(type, name, filter, expr->m_DebugInfo, context);
|
||||||
|
|
||||||
return Empty;
|
return Empty;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@ using namespace icinga;
|
||||||
ObjectRule::RuleMap ObjectRule::m_Rules;
|
ObjectRule::RuleMap ObjectRule::m_Rules;
|
||||||
ObjectRule::CallbackMap ObjectRule::m_Callbacks;
|
ObjectRule::CallbackMap ObjectRule::m_Callbacks;
|
||||||
|
|
||||||
ObjectRule::ObjectRule(const String& name, const Expression::Ptr& expression,
|
ObjectRule::ObjectRule(const String& name, const Expression::Ptr& filter,
|
||||||
const Expression::Ptr& filter, const DebugInfo& di, const Object::Ptr& scope)
|
const DebugInfo& di, const Object::Ptr& scope)
|
||||||
: m_Name(name), m_Expression(expression), m_Filter(filter), m_DebugInfo(di), m_Scope(scope)
|
: m_Name(name), m_Filter(filter), m_DebugInfo(di), m_Scope(scope)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
String ObjectRule::GetName(void) const
|
String ObjectRule::GetName(void) const
|
||||||
|
@ -36,11 +36,6 @@ String ObjectRule::GetName(void) const
|
||||||
return m_Name;
|
return m_Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression::Ptr ObjectRule::GetExpression(void) const
|
|
||||||
{
|
|
||||||
return m_Expression;
|
|
||||||
}
|
|
||||||
|
|
||||||
Expression::Ptr ObjectRule::GetFilter(void) const
|
Expression::Ptr ObjectRule::GetFilter(void) const
|
||||||
{
|
{
|
||||||
return m_Filter;
|
return m_Filter;
|
||||||
|
@ -57,10 +52,9 @@ Object::Ptr ObjectRule::GetScope(void) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectRule::AddRule(const String& sourceType, const String& name,
|
void ObjectRule::AddRule(const String& sourceType, const String& name,
|
||||||
const Expression::Ptr& expression, const Expression::Ptr& filter,
|
const Expression::Ptr& filter, const DebugInfo& di, const Object::Ptr& scope)
|
||||||
const DebugInfo& di, const Object::Ptr& scope)
|
|
||||||
{
|
{
|
||||||
m_Rules[sourceType].push_back(ObjectRule(name, expression, filter, di, scope));
|
m_Rules[sourceType].push_back(ObjectRule(name, filter, di, scope));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectRule::EvaluateFilter(const Object::Ptr& scope) const
|
bool ObjectRule::EvaluateFilter(const Object::Ptr& scope) const
|
||||||
|
|
|
@ -39,14 +39,13 @@ public:
|
||||||
typedef std::map<String, std::vector<ObjectRule> > RuleMap;
|
typedef std::map<String, std::vector<ObjectRule> > RuleMap;
|
||||||
|
|
||||||
String GetName(void) const;
|
String GetName(void) const;
|
||||||
Expression::Ptr GetExpression(void) const;
|
|
||||||
Expression::Ptr GetFilter(void) const;
|
Expression::Ptr GetFilter(void) const;
|
||||||
DebugInfo GetDebugInfo(void) const;
|
DebugInfo GetDebugInfo(void) const;
|
||||||
Object::Ptr GetScope(void) const;
|
Object::Ptr GetScope(void) const;
|
||||||
|
|
||||||
bool EvaluateFilter(const Object::Ptr& scope) const;
|
bool EvaluateFilter(const Object::Ptr& scope) const;
|
||||||
|
|
||||||
static void AddRule(const String& sourceType, const String& name, const Expression::Ptr& expression,
|
static void AddRule(const String& sourceType, const String& name,
|
||||||
const Expression::Ptr& filter, const DebugInfo& di, const Object::Ptr& scope);
|
const Expression::Ptr& filter, const DebugInfo& di, const Object::Ptr& scope);
|
||||||
static void EvaluateRules(bool clear);
|
static void EvaluateRules(bool clear);
|
||||||
|
|
||||||
|
@ -55,7 +54,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
String m_Name;
|
String m_Name;
|
||||||
Expression::Ptr m_Expression;
|
|
||||||
Expression::Ptr m_Filter;
|
Expression::Ptr m_Filter;
|
||||||
DebugInfo m_DebugInfo;
|
DebugInfo m_DebugInfo;
|
||||||
Object::Ptr m_Scope;
|
Object::Ptr m_Scope;
|
||||||
|
@ -63,8 +61,8 @@ private:
|
||||||
static CallbackMap m_Callbacks;
|
static CallbackMap m_Callbacks;
|
||||||
static RuleMap m_Rules;
|
static RuleMap m_Rules;
|
||||||
|
|
||||||
ObjectRule(const String& name, const Expression::Ptr& expression,
|
ObjectRule(const String& name, const Expression::Ptr& filter,
|
||||||
const Expression::Ptr& filter, const DebugInfo& di, const Object::Ptr& scope);
|
const DebugInfo& di, const Object::Ptr& scope);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue