diff --git a/Framework/API/inc/MantidAPI/LogManager.h b/Framework/API/inc/MantidAPI/LogManager.h index 40dafc25508edfa303a227fd3af62974ce278288..23d3789cef19e4d739e9771ad892f5d446cc1a81 100644 --- a/Framework/API/inc/MantidAPI/LogManager.h +++ b/Framework/API/inc/MantidAPI/LogManager.h @@ -2,11 +2,10 @@ #define MANTID_API_LOGMANAGER_H_ #include "MantidAPI/DllConfig.h" -#include "MantidKernel/Cache.h" #include "MantidKernel/make_unique.h" #include "MantidKernel/PropertyManager.h" #include "MantidKernel/Statistics.h" -#include "MantidKernel/TimeSplitter.h" +#include <memory> #include <vector> namespace NeXus { @@ -15,7 +14,10 @@ class File; namespace Mantid { namespace Kernel { +template <class KEYTYPE, class VALUETYPE> class Cache; template <typename TYPE> class TimeSeriesProperty; +class SplittingInterval; +typedef std::vector<SplittingInterval> TimeSplitterType; } namespace API { @@ -50,9 +52,12 @@ namespace API { */ class MANTID_API_DLL LogManager { public: + LogManager(); + LogManager(const LogManager &other); /// Destructor. Doesn't need to be virtual as long as nothing inherits from /// this class. - virtual ~LogManager() = default; + virtual ~LogManager(); + LogManager &operator=(const LogManager &other); //------------------------------------------------------------- /// Set the run start and end @@ -194,11 +199,10 @@ protected: static const char *PROTON_CHARGE_LOG_NAME; private: - /// Cache type for single value logs - typedef Kernel::Cache<std::pair<std::string, Kernel::Math::StatisticType>, - double> SingleValueCache; /// Cache for the retrieved single values - mutable SingleValueCache m_singleValueCache; + std::unique_ptr<Kernel::Cache< + std::pair<std::string, Kernel::Math::StatisticType>, double>> + m_singleValueCache; }; /// shared pointer to the logManager base class typedef boost::shared_ptr<LogManager> LogManager_sptr; diff --git a/Framework/API/src/LogManager.cpp b/Framework/API/src/LogManager.cpp index 27e19477ad0518ef614054fac67f724aa2328e93..15fc61d791106c269e97a53f919d3d3998d065d8 100644 --- a/Framework/API/src/LogManager.cpp +++ b/Framework/API/src/LogManager.cpp @@ -1,6 +1,6 @@ #include "MantidAPI/LogManager.h" +#include "MantidKernel/Cache.h" #include "MantidKernel/PropertyNexus.h" - #include "MantidKernel/TimeSeriesProperty.h" #include <nexus/NeXusFile.hpp> @@ -92,6 +92,27 @@ const char *LogManager::PROTON_CHARGE_LOG_NAME = "gd_prtn_chrg"; // Public member functions //---------------------------------------------------------------------- +LogManager::LogManager() + : m_singleValueCache(Kernel::make_unique<Kernel::Cache< + std::pair<std::string, Kernel::Math::StatisticType>, double>>()) {} + +LogManager::LogManager(const LogManager &other) + : m_manager(other.m_manager), + m_singleValueCache(Kernel::make_unique<Kernel::Cache< + std::pair<std::string, Kernel::Math::StatisticType>, double>>( + *other.m_singleValueCache)) {} + +// Defined as default in source for forward declaration with std::unique_ptr. +LogManager::~LogManager() = default; + +LogManager &LogManager ::operator=(const LogManager &other) { + m_manager = other.m_manager; + m_singleValueCache = Kernel::make_unique<Kernel::Cache< + std::pair<std::string, Kernel::Math::StatisticType>, double>>( + *other.m_singleValueCache); + return *this; +} + /** * Set the run start and end * @param start :: The run start @@ -210,7 +231,7 @@ void LogManager::splitByTime(TimeSplitterType &splitter, */ void LogManager::filterByLog(const Kernel::TimeSeriesProperty<bool> &filter) { // This will invalidate the cache - m_singleValueCache.clear(); + m_singleValueCache->clear(); m_manager.filterByProperty(filter); } @@ -259,7 +280,7 @@ bool LogManager::hasProperty(const std::string &name) const { void LogManager::removeProperty(const std::string &name, bool delProperty) { // Remove any cached entries for this log. Need to make this more general for (unsigned int stat = 0; stat < 7; ++stat) { - m_singleValueCache.removeCache( + m_singleValueCache->removeCache( std::make_pair(name, static_cast<Math::StatisticType>(stat))); } m_manager.removeProperty(name, delProperty); @@ -328,7 +349,7 @@ double LogManager::getPropertyAsSingleValue( const std::string &name, Kernel::Math::StatisticType statistic) const { double singleValue(0.0); const auto key = std::make_pair(name, statistic); - if (!m_singleValueCache.getCache(key, singleValue)) { + if (!m_singleValueCache->getCache(key, singleValue)) { const Property *log = getProperty(name); if (!convertPropertyToDouble(log, singleValue, statistic)) { if (const auto stringLog = @@ -348,7 +369,7 @@ double LogManager::getPropertyAsSingleValue( } } // Put it in the cache - m_singleValueCache.setCache(key, singleValue); + m_singleValueCache->setCache(key, singleValue); } return singleValue; } diff --git a/Framework/Algorithms/src/WorkflowAlgorithmRunner.cpp b/Framework/Algorithms/src/WorkflowAlgorithmRunner.cpp index c41b7b2f6cf0db115c3073f9d21b2d8dc0cbc12a..c0969dddf839feb9f60d955a635465d412d0e670 100644 --- a/Framework/Algorithms/src/WorkflowAlgorithmRunner.cpp +++ b/Framework/Algorithms/src/WorkflowAlgorithmRunner.cpp @@ -3,6 +3,7 @@ #include "MantidAPI/ITableWorkspace.h" #include "MantidKernel/MandatoryValidator.h" +#include <deque> #include <unordered_map> using namespace Mantid::API; diff --git a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp index 67ecb3ad967c9496802e04f08e023223b843a505..72b9c1a637c4254fda2194a92386ad9f34cd30d8 100644 --- a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp +++ b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp @@ -32,6 +32,7 @@ #include <boost/algorithm/string/split.hpp> #include <fstream> +#include <iostream> #include <gsl/gsl_sf_erf.h> #include <cmath> diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp index 6f5b827647867c9ea3e62a67e8995c2d5f9b4367..e7af56df54bd0f9f5e42b0d4b4aa809c7eb19d83 100644 --- a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp @@ -20,6 +20,7 @@ #include <boost/algorithm/string/split.hpp> #include <fstream> +#include <iomanip> const int OBSDATAINDEX(0); const int CALDATAINDEX(1); diff --git a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp index 2868a4a164ea7f207b542ebef22649b8466687f2..59daeb90f0dd230c2e3f0d1d10f876fa67e96044 100644 --- a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp @@ -27,6 +27,8 @@ #include <boost/algorithm/string/split.hpp> #include <fstream> +#include <iomanip> +#include <iostream> #include <gsl/gsl_sf_erf.h> diff --git a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp index 92a3e59b6fe908d787ea675b52b890c82336b849..c16176acee97b70f42c1f18dd88bf809e43010e9 100644 --- a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp @@ -6,6 +6,8 @@ #include "MantidAPI/WorkspaceFactory.h" #include "MantidKernel/ListValidator.h" +#include <iomanip> + using namespace Mantid::API; using namespace Mantid::CurveFitting; using namespace Mantid::CurveFitting::Functions; diff --git a/Framework/CurveFitting/src/Functions/DynamicKuboToyabe.cpp b/Framework/CurveFitting/src/Functions/DynamicKuboToyabe.cpp index 7ad97dd1ed94cbd2e96ad1a9948b20f3a6314b80..14e55390b02533f6bc422f1eb8aea58da8ef61cb 100644 --- a/Framework/CurveFitting/src/Functions/DynamicKuboToyabe.cpp +++ b/Framework/CurveFitting/src/Functions/DynamicKuboToyabe.cpp @@ -5,6 +5,7 @@ #include "MantidKernel/PhysicalConstants.h" #include <iomanip> +#include <sstream> #include <vector> namespace Mantid { diff --git a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h index 903a2d16e7c0b383afdf93b09a7934e1aae05730..233c1a20055e57a6afc44f54949e3f49375657cd 100644 --- a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h +++ b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h @@ -10,6 +10,7 @@ #include "MantidDataObjects/TableWorkspace.h" #include "MantidAPI/TableRow.h" #include <fstream> +#include <iomanip> using Mantid::CurveFitting::Algorithms::RefinePowderInstrumentParameters; using namespace Mantid; diff --git a/Framework/DataHandling/src/SaveFullprofResolution.cpp b/Framework/DataHandling/src/SaveFullprofResolution.cpp index 39047131ac7bba532d80a25fc3023fcdb0b64708..cd37fcf95a5058d4bc5edfdf30c64535710d0888 100644 --- a/Framework/DataHandling/src/SaveFullprofResolution.cpp +++ b/Framework/DataHandling/src/SaveFullprofResolution.cpp @@ -9,6 +9,7 @@ #include <Poco/File.h> #include <fstream> +#include <iomanip> using namespace Mantid; using namespace Mantid::API; diff --git a/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp b/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp index 3ea64b07fe29ad1f7d1269118629bd772efa0387..d6ad78cf3ffa0eb46572c6229274ef34706b5bd0 100644 --- a/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp +++ b/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp @@ -10,6 +10,7 @@ #include <boost/algorithm/string/split.hpp> #include <cstdio> +#include <iomanip> using namespace Mantid; using namespace Mantid::API; diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.tcc b/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.tcc index 2f7c3d4611880cbc978f31b934aecb7403300be7..9e669e616e950e3bffad859a32d1c88f617ca7bc 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.tcc +++ b/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.tcc @@ -19,6 +19,7 @@ #include "MantidKernel/ConfigService.h" #include <iomanip> +#include <iostream> #include <functional> #include <algorithm> #include "MantidDataObjects/MDBoxIterator.h" diff --git a/Framework/DataObjects/src/PeakColumn.cpp b/Framework/DataObjects/src/PeakColumn.cpp index 3f1aec2b8effeed15fc6e9bf8642aeea3f396402..9db8b6cc94a1d215ba22c1fbd79ed2523c1deaae 100644 --- a/Framework/DataObjects/src/PeakColumn.cpp +++ b/Framework/DataObjects/src/PeakColumn.cpp @@ -3,6 +3,7 @@ #include "MantidKernel/Strings.h" #include "MantidKernel/ConfigService.h" #include "MantidKernel/Exception.h" +#include "MantidKernel/MultiThreaded.h" #include <boost/variant/get.hpp> diff --git a/Framework/DataObjects/src/RebinnedOutput.cpp b/Framework/DataObjects/src/RebinnedOutput.cpp index 1313d29bb3ead9870c704693c48b63936a62597b..06cf07e292a979b1348bc866a8759eb6bd520164 100644 --- a/Framework/DataObjects/src/RebinnedOutput.cpp +++ b/Framework/DataObjects/src/RebinnedOutput.cpp @@ -5,6 +5,7 @@ #include <algorithm> #include <iterator> +#include <sstream> namespace Mantid { namespace DataObjects { diff --git a/Framework/Geometry/inc/MantidGeometry/Instrument/ParameterMap.h b/Framework/Geometry/inc/MantidGeometry/Instrument/ParameterMap.h index ffd6091120edfd63ac1f39ad38fd04d73a510859..9ffebaf72b0c3edc51b28a3b1e1960cac4c0be72 100644 --- a/Framework/Geometry/inc/MantidGeometry/Instrument/ParameterMap.h +++ b/Framework/Geometry/inc/MantidGeometry/Instrument/ParameterMap.h @@ -7,7 +7,6 @@ #include "MantidGeometry/IDTypes.h" //For specnum_t #include "MantidGeometry/Instrument/Parameter.h" #include "MantidGeometry/Instrument/ParameterFactory.h" -#include "MantidKernel/Cache.h" #include "tbb/concurrent_unordered_map.h" @@ -16,11 +15,10 @@ #include <typeinfo> namespace Mantid { +namespace Kernel { +template <class KEYTYPE, class VALUETYPE> class Cache; +} namespace Geometry { - -//--------------------------------------------------------------------------- -// Forward declarations -//--------------------------------------------------------------------------- class BoundingBox; /** @class ParameterMap ParameterMap.h @@ -359,9 +357,9 @@ private: /// internal parameter map instance pmap m_map; /// internal cache map instance for cached position values - mutable Kernel::Cache<const ComponentID, Kernel::V3D> m_cacheLocMap; + std::unique_ptr<Kernel::Cache<const ComponentID, Kernel::V3D>> m_cacheLocMap; /// internal cache map instance for cached rotation values - mutable Kernel::Cache<const ComponentID, Kernel::Quat> m_cacheRotMap; + std::unique_ptr<Kernel::Cache<const ComponentID, Kernel::Quat>> m_cacheRotMap; /// internal cache map for cached bounding boxes std::unique_ptr<Kernel::Cache<const ComponentID, BoundingBox>> m_boundingBoxMap; diff --git a/Framework/Geometry/src/Instrument/ParameterMap.cpp b/Framework/Geometry/src/Instrument/ParameterMap.cpp index 8bb0a1697210b4e684b6573a48301c15f9072234..d79e376fe4d51f2e28c774e573531028b4371feb 100644 --- a/Framework/Geometry/src/Instrument/ParameterMap.cpp +++ b/Framework/Geometry/src/Instrument/ParameterMap.cpp @@ -1,6 +1,7 @@ #include "MantidGeometry/Instrument/ParameterMap.h" #include "MantidGeometry/Objects/BoundingBox.h" #include "MantidGeometry/IDetector.h" +#include "MantidKernel/Cache.h" #include "MantidKernel/MultiThreaded.h" #include "MantidGeometry/Instrument.h" #include <cstring> @@ -46,12 +47,21 @@ Kernel::Logger g_log("ParameterMap"); * Default constructor */ ParameterMap::ParameterMap() - : m_boundingBoxMap(Kernel::make_unique< + : m_cacheLocMap( + Kernel::make_unique<Kernel::Cache<const ComponentID, Kernel::V3D>>()), + m_cacheRotMap(Kernel::make_unique< + Kernel::Cache<const ComponentID, Kernel::Quat>>()), + m_boundingBoxMap(Kernel::make_unique< Kernel::Cache<const ComponentID, BoundingBox>>()) {} ParameterMap::ParameterMap(const ParameterMap &other) : m_parameterFileNames(other.m_parameterFileNames), m_map(other.m_map), - m_cacheLocMap(other.m_cacheLocMap), m_cacheRotMap(other.m_cacheRotMap), + m_cacheLocMap( + Kernel::make_unique<Kernel::Cache<const ComponentID, Kernel::V3D>>( + *other.m_cacheLocMap)), + m_cacheRotMap( + Kernel::make_unique<Kernel::Cache<const ComponentID, Kernel::Quat>>( + *other.m_cacheRotMap)), m_boundingBoxMap( Kernel::make_unique<Kernel::Cache<const ComponentID, BoundingBox>>( *other.m_boundingBoxMap)) {} @@ -973,8 +983,8 @@ std::string ParameterMap::asString() const { * Clears the location, rotation & bounding box caches */ void ParameterMap::clearPositionSensitiveCaches() { - m_cacheLocMap.clear(); - m_cacheRotMap.clear(); + m_cacheLocMap->clear(); + m_cacheRotMap->clear(); m_boundingBoxMap->clear(); } @@ -983,7 +993,7 @@ void ParameterMap::clearPositionSensitiveCaches() { /// @param location :: The location void ParameterMap::setCachedLocation(const IComponent *comp, const V3D &location) const { - m_cacheLocMap.setCache(comp->getComponentID(), location); + m_cacheLocMap->setCache(comp->getComponentID(), location); } /// Attempts to retrieve a location from the location cache @@ -992,7 +1002,7 @@ void ParameterMap::setCachedLocation(const IComponent *comp, /// @returns true if the location is in the map, otherwise false bool ParameterMap::getCachedLocation(const IComponent *comp, V3D &location) const { - return m_cacheLocMap.getCache(comp->getComponentID(), location); + return m_cacheLocMap->getCache(comp->getComponentID(), location); } /// Sets a cached rotation on the rotation cache @@ -1000,7 +1010,7 @@ bool ParameterMap::getCachedLocation(const IComponent *comp, /// @param rotation :: The rotation as a quaternion void ParameterMap::setCachedRotation(const IComponent *comp, const Quat &rotation) const { - m_cacheRotMap.setCache(comp->getComponentID(), rotation); + m_cacheRotMap->setCache(comp->getComponentID(), rotation); } /// Attempts to retrieve a rotation from the rotation cache @@ -1009,7 +1019,7 @@ void ParameterMap::setCachedRotation(const IComponent *comp, /// @returns true if the rotation is in the map, otherwise false bool ParameterMap::getCachedRotation(const IComponent *comp, Quat &rotation) const { - return m_cacheRotMap.getCache(comp->getComponentID(), rotation); + return m_cacheRotMap->getCache(comp->getComponentID(), rotation); } /// Sets a cached bounding box diff --git a/Framework/Geometry/src/Rendering/CacheGeometryHandler.cpp b/Framework/Geometry/src/Rendering/CacheGeometryHandler.cpp index dcdb018e5e2c36487eac583452c7cfb959260016..54a9d8d3926f7d608a1d7bfd01388dc5243ca592 100644 --- a/Framework/Geometry/src/Rendering/CacheGeometryHandler.cpp +++ b/Framework/Geometry/src/Rendering/CacheGeometryHandler.cpp @@ -4,6 +4,7 @@ #include "MantidGeometry/Rendering/CacheGeometryHandler.h" #include "MantidGeometry/Rendering/CacheGeometryRenderer.h" #include "MantidGeometry/Rendering/CacheGeometryGenerator.h" +#include "MantidKernel/MultiThreaded.h" #include <boost/make_shared.hpp> diff --git a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertSpiceDataToRealSpace.h b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertSpiceDataToRealSpace.h index 51263d1b46f8275994583af73a8e83e7871d30e2..2768a7ac1aa17f7f8aba067ad49b41bbc9a3a5b6 100644 --- a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertSpiceDataToRealSpace.h +++ b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertSpiceDataToRealSpace.h @@ -7,6 +7,8 @@ #include "MantidGeometry/IDTypes.h" #include "MantidKernel/FileDescriptor.h" +#include <deque> + namespace Mantid { namespace MDAlgorithms { diff --git a/MantidPlot/src/ApplicationWindow.cpp b/MantidPlot/src/ApplicationWindow.cpp index 8e469c1f9ac39bbbaa666d475f6e2fc9cff1a9b3..e388d940432c630ef709957e47382209867d3fbe 100644 --- a/MantidPlot/src/ApplicationWindow.cpp +++ b/MantidPlot/src/ApplicationWindow.cpp @@ -133,6 +133,7 @@ #include <stdio.h> #include <stdlib.h> #include <cassert> +#include <iostream> #include <qwt_scale_engine.h> #include <QColorGroup> diff --git a/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp b/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp index b7db9d66fd463475f605545d76d633f18529a24d..51078ee22ebbc783b38cee6fdf15f6dd4fe0ff57 100644 --- a/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp +++ b/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp @@ -55,6 +55,7 @@ #include <QUrl> #include <algorithm> +#include <iostream> namespace MantidQt { using API::MantidDesktopServices;