[icinga-checkins] icinga.org: icinga2/feature/gelf-writer-7619: Remove unused fields from the ObjectRule class

git at icinga.org git at icinga.org
Mon Nov 10 20:27:19 CET 2014


Module: icinga2
Branch: feature/gelf-writer-7619
Commit: e3c5063aff9cd684236fc88ead440d314ae70484
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=e3c5063aff9cd684236fc88ead440d314ae70484

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Mon Nov 10 09:52:27 2014 +0100

Remove unused fields from the ObjectRule class

refs #7622

---

 lib/config/expression.cpp |    3 ++-
 lib/config/objectrule.cpp |   16 +++++-----------
 lib/config/objectrule.hpp |    8 +++-----
 3 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/lib/config/expression.cpp b/lib/config/expression.cpp
index 6143354..b1514d7 100644
--- a/lib/config/expression.cpp
+++ b/lib/config/expression.cpp
@@ -536,7 +536,8 @@ Value Expression::OpObject(const Expression* expr, const Object::Ptr& context, D
 	item->SetZone(zone);
 	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;
 }
diff --git a/lib/config/objectrule.cpp b/lib/config/objectrule.cpp
index 7fc03e3..1b2c195 100644
--- a/lib/config/objectrule.cpp
+++ b/lib/config/objectrule.cpp
@@ -26,9 +26,9 @@ using namespace icinga;
 ObjectRule::RuleMap ObjectRule::m_Rules;
 ObjectRule::CallbackMap ObjectRule::m_Callbacks;
 
-ObjectRule::ObjectRule(const String& name, const Expression::Ptr& expression,
-    const Expression::Ptr& filter, const DebugInfo& di, const Object::Ptr& scope)
-	: m_Name(name), m_Expression(expression), m_Filter(filter), m_DebugInfo(di), m_Scope(scope)
+ObjectRule::ObjectRule(const String& name, const Expression::Ptr& filter,
+    const DebugInfo& di, const Object::Ptr& scope)
+	: m_Name(name), m_Filter(filter), m_DebugInfo(di), m_Scope(scope)
 { }
 
 String ObjectRule::GetName(void) const
@@ -36,11 +36,6 @@ String ObjectRule::GetName(void) const
 	return m_Name;
 }
 
-Expression::Ptr ObjectRule::GetExpression(void) const
-{
-	return m_Expression;
-}
-
 Expression::Ptr ObjectRule::GetFilter(void) const
 {
 	return m_Filter;
@@ -57,10 +52,9 @@ Object::Ptr ObjectRule::GetScope(void) const
 }
 
 void ObjectRule::AddRule(const String& sourceType, const String& name,
-    const Expression::Ptr& expression, const Expression::Ptr& filter,
-    const DebugInfo& di, const Object::Ptr& scope)
+    const Expression::Ptr& filter, 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
diff --git a/lib/config/objectrule.hpp b/lib/config/objectrule.hpp
index 3a0b563..cdb94af 100644
--- a/lib/config/objectrule.hpp
+++ b/lib/config/objectrule.hpp
@@ -39,14 +39,13 @@ public:
 	typedef std::map<String, std::vector<ObjectRule> > RuleMap;
 
 	String GetName(void) const;
-	Expression::Ptr GetExpression(void) const;
 	Expression::Ptr GetFilter(void) const;
 	DebugInfo GetDebugInfo(void) const;
 	Object::Ptr GetScope(void) 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);
 	static void EvaluateRules(bool clear);
 
@@ -55,7 +54,6 @@ public:
 
 private:
 	String m_Name;
-	Expression::Ptr m_Expression;
 	Expression::Ptr m_Filter;
 	DebugInfo m_DebugInfo;
 	Object::Ptr m_Scope;
@@ -63,8 +61,8 @@ private:
 	static CallbackMap m_Callbacks;
 	static RuleMap m_Rules;
 
-	ObjectRule(const String& name, const Expression::Ptr& expression,
-	    const Expression::Ptr& filter, const DebugInfo& di, const Object::Ptr& scope);
+	ObjectRule(const String& name, const Expression::Ptr& filter,
+	    const DebugInfo& di, const Object::Ptr& scope);
 };
 
 }



More information about the icinga-checkins mailing list