From 33de68d8a81104dcc23688cdcfdff8e2377e4fce Mon Sep 17 00:00:00 2001
From: Otmane Lahlou <otmane.lahlou@c-s.fr>
Date: Wed, 20 Jan 2010 10:43:25 +0100
Subject: [PATCH] ENH : implement != and == operators and make an attribute
 static const

---
 Code/Radiometry/otbVegetationIndicesFunctor.h | 31 ++++++++++++++++---
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/Code/Radiometry/otbVegetationIndicesFunctor.h b/Code/Radiometry/otbVegetationIndicesFunctor.h
index acbb68992e..b245362d60 100755
--- a/Code/Radiometry/otbVegetationIndicesFunctor.h
+++ b/Code/Radiometry/otbVegetationIndicesFunctor.h
@@ -44,7 +44,17 @@ public:
   /// Vector pixel type used to support both vector images and multiple
   /// input images
   typedef itk::VariableLengthVector<TInput1> InputVectorType;
-
+	
+  //operators != 
+    bool operator!=( const RAndNIRIndexBase & ) const
+   {
+  return false;
+    }
+  //operator ==
+   bool operator==( const RAndNIRIndexBase & other ) const
+    {
+     return !(*this != other);
+    }
   // Operator on vector pixel type
   inline TOutput operator()(const InputVectorType & inputVector)
   {
@@ -57,7 +67,7 @@ public:
     return this->Evaluate(r,nir);
   };
   /// Constructor
-  RAndNIRIndexBase() :  m_EpsilonToBeConsideredAsZero(0.0000001), m_RedIndex(3), m_NIRIndex(4) {};
+  RAndNIRIndexBase() :  m_RedIndex(3), m_NIRIndex(4) {}
   /// Desctructor
   virtual ~RAndNIRIndexBase() {};
 
@@ -85,7 +95,7 @@ protected:
   // This method must be reimplemented in subclasses to actually
   // compute the index value
   virtual TOutput Evaluate(const TInput1 & r, const TInput2 & nir) const = 0;
-  const double m_EpsilonToBeConsideredAsZero;
+  static const double m_EpsilonToBeConsideredAsZero = 0.0000001;
 
 private:
   unsigned int m_RedIndex;
@@ -109,13 +119,24 @@ public:
   /// Vector pixel type used to support both vector images and multiple
   /// input images
   typedef itk::VariableLengthVector<TInput1> InputVectorType;
-
+  
+  //operators != 
+  bool operator!=( const  RAndBAndNIRIndexBase& ) const
+   {
+     return false;
+   }
+  
+  //operator ==
+   bool operator==( const  RAndBAndNIRIndexBase& other ) const
+  {
+    return !(*this != other);
+  }
+  
   // Operator on vector pixel type
   inline TOutput operator()(const InputVectorType & inputVector)
   {
     return this->Evaluate(inputVector[m_RedIndex-1],static_cast<TInput2>(inputVector[m_BlueIndex-1]), static_cast<TInput3>(inputVector[m_NIRIndex-1]));
   }
-
   // Binary operator
   inline TOutput operator()(const TInput1 &r, const TInput2 &b, const TInput2 &nir)
   {
-- 
GitLab