From 26f16f2ea2b0c6f4b300e46743d64421f84cdd7b Mon Sep 17 00:00:00 2001
From: Alex Buts <Alex.Buts@stfc.ac.uk>
Date: Thu, 4 Oct 2012 13:33:30 +0100
Subject: [PATCH] refs #5871 Merging with Base

and making copy constructor for table workspace private (the clone method exist)
---
 .../API/inc/MantidAPI/ITableWorkspace.h       |  4 +---
 .../Framework/API/src/ITableWorkspace.cpp     | 21 -------------------
 .../Framework/CurveFitting/src/LeBailFit.cpp  |  3 +--
 .../src/RefinePowderInstrumentParameters.cpp  |  4 ++--
 .../inc/MantidDataObjects/PeaksWorkspace.h    |  3 +--
 .../inc/MantidDataObjects/TableWorkspace.h    | 16 ++++----------
 6 files changed, 9 insertions(+), 42 deletions(-)

diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/ITableWorkspace.h b/Code/Mantid/Framework/API/inc/MantidAPI/ITableWorkspace.h
index f2074c56d1a..c73cb5f14f7 100644
--- a/Code/Mantid/Framework/API/inc/MantidAPI/ITableWorkspace.h
+++ b/Code/Mantid/Framework/API/inc/MantidAPI/ITableWorkspace.h
@@ -117,8 +117,7 @@ class MANTID_API_DLL ITableWorkspace: public API::Workspace
 {
 public:
   ///Constructor
-  ITableWorkspace()
-  {}
+  ITableWorkspace() {}
   /// Virtual destructor.
   virtual ~ITableWorkspace(){}
  
@@ -320,7 +319,6 @@ protected:
 private:
   /// Logger
   static Kernel::Logger& g_log;
-  // Non-copyable, non-assignable
 
 };
 
diff --git a/Code/Mantid/Framework/API/src/ITableWorkspace.cpp b/Code/Mantid/Framework/API/src/ITableWorkspace.cpp
index 62ea975c150..058e78c06dd 100644
--- a/Code/Mantid/Framework/API/src/ITableWorkspace.cpp
+++ b/Code/Mantid/Framework/API/src/ITableWorkspace.cpp
@@ -11,27 +11,6 @@ namespace API
 // Get a reference to the logger
 Kernel::Logger& ITableWorkspace::g_log = Kernel::Logger::get("ITableWorkspace");
 
-/// Constructor
-ITableWorkspace::ITableWorkspace() : m_LogManager(new API::LogManager)
-{}
-
-/// Virtual destructor.
-ITableWorkspace::~ITableWorkspace()
-{}
- 
-/// Copy constructor
-ITableWorkspace::ITableWorkspace(const ITableWorkspace &other) : Workspace(other)
-{
-  m_LogManager = boost::make_shared<API::LogManager>(*other.m_LogManager);
-}
-
-/// Assignemtn
-ITableWorkspace & ITableWorkspace::operator=(const ITableWorkspace &rhs)
-{
-  if(&rhs != this)m_LogManager = boost::make_shared<API::LogManager>(*rhs.m_LogManager);
-  return *this;  
-}
-
 
 /** Creates n new columns of the same type
  * @param type :: The datatype of the column
diff --git a/Code/Mantid/Framework/CurveFitting/src/LeBailFit.cpp b/Code/Mantid/Framework/CurveFitting/src/LeBailFit.cpp
index 561c0f49940..40e3f137ea5 100644
--- a/Code/Mantid/Framework/CurveFitting/src/LeBailFit.cpp
+++ b/Code/Mantid/Framework/CurveFitting/src/LeBailFit.cpp
@@ -1544,8 +1544,7 @@ bool LeBailFit::fitLeBailFunction(size_t workspaceindex, std::map<std::string, P
 void LeBailFit::exportEachPeaksParameters()
 {
   // 1. Create peaks workspace
-  DataObjects::TableWorkspace tbws;
-  DataObjects::TableWorkspace_sptr peakWS = boost::make_shared<DataObjects::TableWorkspace>(tbws);
+  DataObjects::TableWorkspace_sptr peakWS = DataObjects::TableWorkspace_sptr(new DataObjects::TableWorkspace);
 
   // 2. Set up peak workspace
   peakWS->addColumn("int", "H");
diff --git a/Code/Mantid/Framework/CurveFitting/src/RefinePowderInstrumentParameters.cpp b/Code/Mantid/Framework/CurveFitting/src/RefinePowderInstrumentParameters.cpp
index dbeb52b9728..c8898dc1d04 100644
--- a/Code/Mantid/Framework/CurveFitting/src/RefinePowderInstrumentParameters.cpp
+++ b/Code/Mantid/Framework/CurveFitting/src/RefinePowderInstrumentParameters.cpp
@@ -130,8 +130,8 @@ DECLARE_ALGORITHM(RefinePowderInstrumentParameters)
       this->setProperty("OutputDataWorkspace", peakdataws);
 
       // 7. Output new instrument parameters
-      DataObjects::TableWorkspace rawtable;
-      DataObjects::TableWorkspace_sptr newtablews = boost::make_shared<DataObjects::TableWorkspace>(rawtable);
+      //DataObjects::TableWorkspace rawtable; -->> TableWorkspace is not copyable (default CC is incorrect and no point in writing a non-default one)
+      DataObjects::TableWorkspace_sptr newtablews = boost::shared_ptr<DataObjects::TableWorkspace>(new DataObjects::TableWorkspace());
       newtablews->addColumn("str", "Name");
       newtablews->addColumn("double", "Value");
       newtablews->addColumn("str", "FitOrTie");
diff --git a/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/PeaksWorkspace.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/PeaksWorkspace.h
index 46cd6664cc4..7379e8effa3 100644
--- a/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/PeaksWorkspace.h
+++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/PeaksWorkspace.h
@@ -83,8 +83,7 @@ namespace DataObjects
     API::LogManager_sptr logs();
     /**Get constant access to shared pointer containing workspace porperties;
        Copies logs into new LogManager variable
-       Meaningfull only for some multithereaded methods when a thread may want to have its own copy of logs
-    */
+       Meaningfull only for some multithereaded methods when a thread may want to have its own copy of logs   */
     API::LogManager_const_sptr getLogs()const{return API::LogManager_const_sptr(new API::LogManager(this->run()));}
 
     virtual ~PeaksWorkspace();
diff --git a/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/TableWorkspace.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/TableWorkspace.h
index 3fdebc1e728..434da58c055 100644
--- a/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/TableWorkspace.h
+++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/TableWorkspace.h
@@ -383,17 +383,6 @@ private:
       findValue(value,row,col);
     }
 
-/// Copy constructor
-   TableWorkspace(const TableWorkspace &other);
-  //{
-  //  m_LogManager = boost::make_shared<API::LogManager>(*other.m_LogManager);
-  //}
-  /// Operator =
-  TableWorkspace & operator=(const TableWorkspace &rhs);
-  //{
-  //  if(&rhs != this)m_LogManager = boost::make_shared<API::LogManager>(*rhs.m_LogManager);
-  //  return *this;  
-  //}
 private:
     /// Used in std::find_if algorithm to find a Column with name \a name.
     class FindName
@@ -425,7 +414,10 @@ private:
     /// shared pointer to the logManager, responsible for the workspace properties.   
     API::LogManager_sptr m_LogManager;
 
-
+    // not asignable, not copy constructable, clonable
+/// Copy constructor
+   TableWorkspace(const TableWorkspace &other);
+   TableWorkspace & operator=(const TableWorkspace &rhs);
 };
 
 /// Typedef for a shared pointer to \c TableWorkspace
-- 
GitLab