From fda5204cb7a7c7340e093dbbd0b893f652eb70a9 Mon Sep 17 00:00:00 2001 From: Alex Buts <Alex.Buts@stfc.ac.uk> Date: Wed, 3 Oct 2012 11:59:44 +0100 Subject: [PATCH] refs #5742 got rid of annoying warning in Kernel TimeSerires property when getValues instantiated for bool. Do not know if the resulting function is correct but not more wrong then the previous one. --- .../API/inc/MantidAPI/ITableWorkspace.h | 4 ++-- .../inc/MantidDataObjects/TableWorkspace.h | 3 +++ .../Kernel/inc/MantidKernel/TimeSeriesProperty.h | 3 ++- .../Framework/Kernel/src/TimeSeriesProperty.cpp | 16 ++++++++-------- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/ITableWorkspace.h b/Code/Mantid/Framework/API/inc/MantidAPI/ITableWorkspace.h index 36108182727..922b1ed1402 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/ITableWorkspace.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/ITableWorkspace.h @@ -8,7 +8,7 @@ #include "MantidAPI/Workspace.h" #include "MantidAPI/Column.h" #include "MantidKernel/V3D.h" - +#include "MantidKernel/PropertyManager.h" #include <boost/shared_ptr.hpp> #include <boost/lexical_cast.hpp> @@ -125,7 +125,7 @@ public: // ===================================================================================== -class ITableWorkspace_DllExport ITableWorkspace: public API::Workspace +class ITableWorkspace_DllExport ITableWorkspace: public API::Workspace, virtual public PropertyManager { public: /// Virtual destructor. diff --git a/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/TableWorkspace.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/TableWorkspace.h index 7cf22965acd..4d16509e79d 100644 --- a/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/TableWorkspace.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/TableWorkspace.h @@ -6,6 +6,7 @@ //---------------------------------------------------------------------- #include "MantidKernel/System.h" +#include "MantidKernel/PropertyManager.h" #include "MantidAPI/ITableWorkspace.h" #include "MantidDataObjects/TableColumn.h" #include <boost/shared_ptr.hpp> @@ -406,6 +407,8 @@ private: /// Logger static Kernel::Logger& g_log; + Kernel::PropertyManager_sptr m_TableProperties; + }; /// Typedef for a shared pointer to \c TableWorkspace diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/TimeSeriesProperty.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/TimeSeriesProperty.h index 363b8719b5e..1686ac33581 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/TimeSeriesProperty.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/TimeSeriesProperty.h @@ -224,7 +224,8 @@ namespace Mantid TYPE getSingleValue(const DateAndTime& t, int& index) const; /// Returns total value, added up for all times regardless of filter TYPE getTotalValue() const; - //template<typename U,typename TYPE> U getTotalValue() const; + //template<> int TimeSeriesProperty<bool>::getTotalValue() const; + /// Returns n-th valid time interval, in a very inefficient way. TimeInterval nthInterval(int n) const; diff --git a/Code/Mantid/Framework/Kernel/src/TimeSeriesProperty.cpp b/Code/Mantid/Framework/Kernel/src/TimeSeriesProperty.cpp index 0f41a965891..ea82849fcc1 100644 --- a/Code/Mantid/Framework/Kernel/src/TimeSeriesProperty.cpp +++ b/Code/Mantid/Framework/Kernel/src/TimeSeriesProperty.cpp @@ -961,7 +961,7 @@ namespace Mantid * Returns total value, added up for all times regardless of filter * @return Total value from all times */ - template<typename TYPE> + template<typename TYPE> TYPE TimeSeriesProperty<TYPE>::getTotalValue() const { TYPE total = 0; @@ -973,18 +973,18 @@ namespace Mantid return total; } - /* template<> - int TimeSeriesProperty<bool>::getTotalValue() const + template<> + bool TimeSeriesProperty<bool>::getTotalValue() const { - int total = 0; + if(m_values.size()==0)return false; + bool total = m_values[0].value(); - for (size_t i = 0; i < m_values.size(); ++i) + for (size_t i = 1; i < m_values.size(); ++i) { - if(m_values[i].value())total++; + total&=m_values[i].value(); } return total; - }*/ - + } /** Returns n-th valid time interval, in a very inefficient way. -- GitLab