From 7d3eaedebb29bf0711361e1e65b014c71af7e34d Mon Sep 17 00:00:00 2001
From: Julien Malik <julien.malik@c-s.fr>
Date: Sat, 25 Feb 2012 19:04:30 +0100
Subject: [PATCH] BUG: fix non-const Modified()

---
 Code/BasicFilters/otbMeanShiftImageFilter.h        | 4 ++--
 Code/Common/otbImageRegionAdaptativeSplitter.h     | 4 ++--
 Code/Common/otbPolyLineParametricPathWithValue.h   | 2 +-
 Code/Common/otbPolyLineParametricPathWithValue.txx | 2 +-
 Code/Common/otbPolygon.h                           | 2 +-
 Code/Common/otbPolygon.txx                         | 2 +-
 Code/Projections/otbGenericRSTransform.h           | 4 ++--
 7 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/Code/BasicFilters/otbMeanShiftImageFilter.h b/Code/BasicFilters/otbMeanShiftImageFilter.h
index 364f7ce948..8c34617d8f 100644
--- a/Code/BasicFilters/otbMeanShiftImageFilter.h
+++ b/Code/BasicFilters/otbMeanShiftImageFilter.h
@@ -169,7 +169,7 @@ protected:
   /** Allocate the outputs (need to be reimplemented since outputs have differents type) */
   virtual void AllocateOutputs();
   /** If modified, we have to reset the list of modes */
-  virtual void Modified()
+  virtual void Modified() const
   {
     Superclass::Modified();
     m_Modes.clear();
@@ -196,7 +196,7 @@ private:
   /** Data scale (used to stretch data range) */
   double m_Scale;
   /** A map of the different modes by segmented regions */
-  ModeMapType m_Modes;
+  mutable ModeMapType m_Modes;
 };
 } // end namespace otb
 
diff --git a/Code/Common/otbImageRegionAdaptativeSplitter.h b/Code/Common/otbImageRegionAdaptativeSplitter.h
index 30ecedd5b4..b4a4345482 100644
--- a/Code/Common/otbImageRegionAdaptativeSplitter.h
+++ b/Code/Common/otbImageRegionAdaptativeSplitter.h
@@ -130,7 +130,7 @@ public:
                               const RegionType& region);
 
   /** Make the Modified() method update the IsUpToDate flag */
-  virtual void Modified()
+  virtual void Modified() const
   {
     // Call superclass implementation
     Superclass::Modified();
@@ -171,7 +171,7 @@ private:
   StreamVectorType m_StreamVector;
 
   // Is the splitter up-to-date ?
-  bool m_IsUpToDate;
+  mutable bool m_IsUpToDate;
 
   // Lock to ensure thread-safety
   itk::SimpleFastMutexLock m_Lock;
diff --git a/Code/Common/otbPolyLineParametricPathWithValue.h b/Code/Common/otbPolyLineParametricPathWithValue.h
index 9c6b041890..a63bb4a376 100644
--- a/Code/Common/otbPolyLineParametricPathWithValue.h
+++ b/Code/Common/otbPolyLineParametricPathWithValue.h
@@ -111,7 +111,7 @@ protected:
 
   virtual void ComputeLength() const;
   virtual void ComputeBoundingRegion() const;
-  virtual void Modified();
+  virtual void Modified() const;
 
 private:
   PolyLineParametricPathWithValue(const Self &); //purposely not implemented
diff --git a/Code/Common/otbPolyLineParametricPathWithValue.txx b/Code/Common/otbPolyLineParametricPathWithValue.txx
index 1877346e77..36cd8e53b0 100644
--- a/Code/Common/otbPolyLineParametricPathWithValue.txx
+++ b/Code/Common/otbPolyLineParametricPathWithValue.txx
@@ -193,7 +193,7 @@ PolyLineParametricPathWithValue<TValue, VDimension>
 template <class TValue, unsigned int VDimension>
 void
 PolyLineParametricPathWithValue<TValue, VDimension>
-::Modified()
+::Modified() const
 {
   m_LengthIsValid = false;
   m_BoundingRegionIsValid = false;
diff --git a/Code/Common/otbPolygon.h b/Code/Common/otbPolygon.h
index 2086fa81ab..fb19c026eb 100644
--- a/Code/Common/otbPolygon.h
+++ b/Code/Common/otbPolygon.h
@@ -151,7 +151,7 @@ protected:
   virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
 
   virtual void ComputeArea() const;
-  virtual void Modified();
+  virtual void Modified() const;
 
 private:
   Polygon(const Self &); //purposely not implemented
diff --git a/Code/Common/otbPolygon.txx b/Code/Common/otbPolygon.txx
index b17ffe1e16..fcc72e470e 100644
--- a/Code/Common/otbPolygon.txx
+++ b/Code/Common/otbPolygon.txx
@@ -527,7 +527,7 @@ double Polygon<TValue>
 template <class TValue>
 void
 Polygon<TValue>
-::Modified()
+::Modified() const
 {
   Superclass::Modified();
   m_AreaIsValid = false;
diff --git a/Code/Projections/otbGenericRSTransform.h b/Code/Projections/otbGenericRSTransform.h
index 4a0bed472e..6c9601387d 100644
--- a/Code/Projections/otbGenericRSTransform.h
+++ b/Code/Projections/otbGenericRSTransform.h
@@ -190,7 +190,7 @@ protected:
   GenericRSTransform();
   virtual ~GenericRSTransform() {}
 
-  virtual void Modified()
+  virtual void Modified() const
   {
     this->Superclass::Modified();
     m_TransformUpToDate = false;
@@ -223,7 +223,7 @@ private:
 
   GenericTransformPointerType   m_InputTransform;
   GenericTransformPointerType   m_OutputTransform;
-  bool                          m_TransformUpToDate;
+  mutable bool                  m_TransformUpToDate;
   Projection::TransformAccuracy m_TransformAccuracy;
 
 };
-- 
GitLab