From c4be6ab8d5d76cc42f97f1d237aeafa7762bac0d Mon Sep 17 00:00:00 2001
From: Andrei Savici <saviciat@ornl.gov>
Date: Tue, 16 Apr 2013 11:42:05 -0400
Subject: [PATCH] Forget property value. Refs #3219

---
 .../Kernel/inc/MantidKernel/MaskedProperty.h    |  8 ++------
 .../Kernel/inc/MantidKernel/Property.h          |  6 +++++-
 Code/Mantid/Framework/Kernel/src/Property.cpp   | 17 ++++++++++++++---
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/MaskedProperty.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/MaskedProperty.h
index 99dd619b240..a229b522238 100644
--- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/MaskedProperty.h
+++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/MaskedProperty.h
@@ -51,6 +51,7 @@ namespace Mantid
                      const unsigned int direction = Direction::Input):
         Kernel::PropertyWithValue<TYPE>(name,defaultvalue , validator, direction ),m_maskedValue("")
         {
+          this->setRemember(false);
         }
 
       /** Constructor  for Maskedproperty class
@@ -61,7 +62,7 @@ namespace Mantid
       MaskedProperty( const std::string& name, const TYPE& defaultvalue, const unsigned int direction):
         Kernel::PropertyWithValue <TYPE>(name,defaultvalue,direction ),m_maskedValue("")
         {
-
+          this->setRemember(false);
         }
 
       /**
@@ -83,11 +84,6 @@ namespace Mantid
         doMasking();
         return m_maskedValue;
       }
-      /**
-       * Do not remember the inputs from a masked property
-       * @return do not remember masked property values
-       */
-      virtual bool remember() const { return false; };
 
       // Unhide the PropertyWithValue assignment operator
       using Kernel::PropertyWithValue<TYPE>::operator=;
diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/Property.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/Property.h
index 447f3a97658..e8350d55d95 100644
--- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/Property.h
+++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/Property.h
@@ -118,7 +118,8 @@ public:
   ///Overriden function that returns if property has the same value that it was initialised with, if applicable
   virtual bool isDefault() const = 0;
   ///Whether to save input values
-  virtual bool remember() const;
+  bool remember() const;
+  void setRemember(bool);
 
   /**Sets the user level description of the property
    *  @param documentation :: The string that the user will see
@@ -204,6 +205,9 @@ private:
 
   /// Private default constructor
   Property();
+
+  /// Flag whether to save input values
+  bool m_remember;
 };
 
   /// Return the name corresponding to the mangled string given by typeid
diff --git a/Code/Mantid/Framework/Kernel/src/Property.cpp b/Code/Mantid/Framework/Kernel/src/Property.cpp
index b2ae5d1970b..edf8fcdc89c 100644
--- a/Code/Mantid/Framework/Kernel/src/Property.cpp
+++ b/Code/Mantid/Framework/Kernel/src/Property.cpp
@@ -21,7 +21,8 @@ Property::Property( const std::string &name, const std::type_info &type, const u
   m_direction( direction ),
   m_units(""),
   m_settings(NULL),
-  m_group("")
+  m_group(""),
+  m_remember(true)
 {
     // Make sure a random int hasn't been passed in for the direction
     // Property & PropertyWithValue destructors will be called in this case
@@ -36,7 +37,8 @@ Property::Property( const Property& right ) :
   m_direction( right.m_direction ),
   m_units( right.m_units),
   m_settings(NULL),
-  m_group( right.m_group)
+  m_group( right.m_group),
+  m_remember(right.m_remember)
 {
   if (right.m_settings)
     m_settings = right.m_settings->clone();
@@ -103,7 +105,16 @@ std::string Property::isValid() const
 */
 bool Property::remember() const
 {
-  return true;
+  return m_remember;
+}
+
+/**
+ * Set wheter to remeber this property input
+ * @param remember :: true to remember
+ */
+void Property::setRemember(bool remember)
+{
+    m_remember=remember;
 }
 
 /** Sets the property's (optional) documentation string
-- 
GitLab