From f68c44e849e0707ff5cc28dd7595273dd6206d39 Mon Sep 17 00:00:00 2001 From: Nick Draper <nick.draper@stfc.ac.uk> Date: Wed, 14 Nov 2007 10:17:44 +0000 Subject: [PATCH] Renamed configsvc to ConfigService re #47 --- Code/Mantid/Algorithms/test/runTests.bat | 7 +-- Code/Mantid/Geometry/test/runTests.bat | 7 +-- Code/Mantid/Kernel/Kernel.vcproj | 4 +- .../inc/{ConfigSvc.h => ConfigService.h} | 24 +++++----- Code/Mantid/Kernel/inc/FrameworkManager.h | 4 +- .../src/{ConfigSvc.cpp => ConfigService.cpp} | 44 +++++++++---------- Code/Mantid/Kernel/src/FrameworkManager.cpp | 4 +- .../{ConfigSvcTest.h => ConfigServiceTest.h} | 16 +++---- Code/Mantid/Kernel/test/runTests.bat | 7 +-- 9 files changed, 51 insertions(+), 66 deletions(-) rename Code/Mantid/Kernel/inc/{ConfigSvc.h => ConfigService.h} (86%) rename Code/Mantid/Kernel/src/{ConfigSvc.cpp => ConfigService.cpp} (80%) rename Code/Mantid/Kernel/test/{ConfigSvcTest.h => ConfigServiceTest.h} (90%) diff --git a/Code/Mantid/Algorithms/test/runTests.bat b/Code/Mantid/Algorithms/test/runTests.bat index 8d6c18e5c3c..f609d887a18 100755 --- a/Code/Mantid/Algorithms/test/runTests.bat +++ b/Code/Mantid/Algorithms/test/runTests.bat @@ -1,5 +1,5 @@ @echo off -REM IF "%VCINSTALLDIR%"=="" SET PATH=%path%;C:\Mantid\Code\Third_Party\lib\win32 +IF "%VCINSTALLDIR%"=="" SET PATH=%CD%\..\..\..\Third_Party\lib\win32;%CD%\..\..\Debug;%PATH% IF "%VCINSTALLDIR%"=="" CALL "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" REM Simple script to build and run the tests. REM Have kept separate from the makefile since that's automatically generated @@ -14,10 +14,6 @@ echo "Compiling the test executable..." cl runner.cpp /I "..\..\..\Third_Party\include" /I "..\.." /EHsc /MTd /W3 /nologo /c /ZI /TP link /OUT:"runner.exe" /NOLOGO /LIBPATH:"../../Debug" /LIBPATH:"../../../Third_Party/lib/win32" /DEBUG /PDB:".\runner.pdb" kernel.lib algorithms.lib dataobjects.lib runner.obj - -echo "Copying in required dlls..." -copy ..\..\..\Third_Party\lib\win32\*.dll . -copy ..\..\debug\*.dll . echo "Running the tests..." runner.exe @@ -28,7 +24,6 @@ echo "Cleaning up..." del runner.cpp del *.obj del *.pdb -del *.dll del runner.lib del runner.ilk del runner.exp diff --git a/Code/Mantid/Geometry/test/runTests.bat b/Code/Mantid/Geometry/test/runTests.bat index 04f61118428..94521341b60 100644 --- a/Code/Mantid/Geometry/test/runTests.bat +++ b/Code/Mantid/Geometry/test/runTests.bat @@ -1,5 +1,5 @@ @echo off -REM IF "%VCINSTALLDIR%"=="" SET PATH=%path%;C:\Mantid\Code\Third_Party\lib\win32 +IF "%VCINSTALLDIR%"=="" SET PATH=%CD%\..\..\..\Third_Party\lib\win32;%CD%\..\..\Debug;%PATH% IF "%VCINSTALLDIR%"=="" CALL "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" REM Simple script to build and run the tests. REM Have kept separate from the makefile since that's automatically generated @@ -24,10 +24,6 @@ echo "Compiling the test executable..." cl runner.cpp /I "..\..\Kernel\inc" /I "..\..\..\Third_Party\include" /I "..\.." /EHsc /MDd /W3 /nologo /c /ZI /TP link /OUT:"runner.exe" /NOLOGO /LIBPATH:"../../Debug" /LIBPATH:"../../../Third_Party/lib/win32" /DEBUG /PDB:".\runner.pdb" kernel.lib Geometry.lib runner.obj - -echo "Copying in required dlls..." -copy ..\..\..\Third_Party\lib\win32\*.dll . -copy ..\..\debug\*.dll . echo "Running the tests..." runner.exe @@ -38,7 +34,6 @@ echo "Cleaning up..." del runner.cpp del *.obj del *.pdb -del *.dll del runner.lib del runner.ilk del runner.exp diff --git a/Code/Mantid/Kernel/Kernel.vcproj b/Code/Mantid/Kernel/Kernel.vcproj index 679d259e3e1..c4bb949108a 100644 --- a/Code/Mantid/Kernel/Kernel.vcproj +++ b/Code/Mantid/Kernel/Kernel.vcproj @@ -166,7 +166,7 @@ > </File> <File - RelativePath=".\src\ConfigSvc.cpp" + RelativePath=".\src\ConfigService.cpp" > </File> <File @@ -220,7 +220,7 @@ > </File> <File - RelativePath=".\inc\ConfigSvc.h" + RelativePath=".\inc\ConfigService.h" > </File> <File diff --git a/Code/Mantid/Kernel/inc/ConfigSvc.h b/Code/Mantid/Kernel/inc/ConfigService.h similarity index 86% rename from Code/Mantid/Kernel/inc/ConfigSvc.h rename to Code/Mantid/Kernel/inc/ConfigService.h index 6246092ac6f..ee846e8b622 100644 --- a/Code/Mantid/Kernel/inc/ConfigSvc.h +++ b/Code/Mantid/Kernel/inc/ConfigService.h @@ -1,5 +1,5 @@ -#ifndef MANTID_KERNEL_CONFIGSVC_H_ -#define MANTID_KERNEL_CONFIGSVC_H_ +#ifndef MANTID_KERNEL_CONFIGSERVICE_H_ +#define MANTID_KERNEL_CONFIGSERVICE_H_ //---------------------------------------------------------------------- // Includes @@ -27,9 +27,9 @@ namespace Mantid { namespace Kernel { -/** @class ConfigSvc ConfigSvc.h Kernel/ConfigSvc.h +/** @class ConfigService ConfigService.h Kernel/ConfigService.h - The ConfigSvc class provides a simple facade to access the Configuration functionality of the Mantid Framework. + The ConfigService class provides a simple facade to access the Configuration functionality of the Mantid Framework. The class gathers information from config files and the system variables. This information is available to all the objects within the framework as well as being used to configure the logging framework. This class currently uses the Logging functionality provided through the POCO (portable components library). @@ -57,7 +57,7 @@ namespace Kernel File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>. Code Documentation is available at: <http://doxygen.mantidproject.org> */ - class DLLExport ConfigSvc + class DLLExport ConfigService { /** Inner templated class to wrap the poco library objects that have protected * desctructors and expose them as public. @@ -107,11 +107,11 @@ namespace Kernel T* m_pPtr; }; - // Back to the ConfigSvc class itself... + // Back to the ConfigService class itself... public: // Returns the single instance of the service - static ConfigSvc* Instance(); + static ConfigService* Instance(); // Loads a config file void loadConfig(const std::string& filename); @@ -137,11 +137,11 @@ namespace Kernel private: // Private constructors and destructor for singleton class - ConfigSvc(); + ConfigService(); /// Private copy constructor. Prevents singleton being copied. - ConfigSvc(const ConfigSvc&) {} + ConfigService(const ConfigService&) {} - virtual ~ConfigSvc(); + virtual ~ConfigService(); /// the POCO file config object WrappedObject<Poco::Util::PropertyFileConfiguration>* m_pConf; @@ -149,11 +149,11 @@ namespace Kernel WrappedObject<Poco::Util::SystemConfiguration>* m_pSysConfig; /// Pointer to the factory instance - static ConfigSvc* m_instance; + static ConfigService* m_instance; }; } // namespace Kernel } // namespace Mantid -#endif /*MANTID_KERNEL_CONFIGSVC_H_*/ +#endif /*MANTID_KERNEL_CONFIGSERVICE_H_*/ diff --git a/Code/Mantid/Kernel/inc/FrameworkManager.h b/Code/Mantid/Kernel/inc/FrameworkManager.h index c5a20ec6cf2..3b3fefee899 100644 --- a/Code/Mantid/Kernel/inc/FrameworkManager.h +++ b/Code/Mantid/Kernel/inc/FrameworkManager.h @@ -22,7 +22,7 @@ class Workspace; class AlgorithmManager; class WorkspaceFactory; class AnalysisDataService; -class ConfigSvc; +class ConfigService; /** @class FrameworkManager FrameworkManager.h Kernel/FrameworkManager.h @@ -88,7 +88,7 @@ private: /// Pointer to the Analysis Data Service AnalysisDataService *data; /// Pointer to the Configuration Service - ConfigSvc *config; + ConfigService *config; }; diff --git a/Code/Mantid/Kernel/src/ConfigSvc.cpp b/Code/Mantid/Kernel/src/ConfigService.cpp similarity index 80% rename from Code/Mantid/Kernel/src/ConfigSvc.cpp rename to Code/Mantid/Kernel/src/ConfigService.cpp index a2d10af0d7c..fe7ff1cdbe3 100644 --- a/Code/Mantid/Kernel/src/ConfigSvc.cpp +++ b/Code/Mantid/Kernel/src/ConfigService.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "ConfigSvc.h" +#include "ConfigService.h" #include "Support.h" #include "Poco/Util/LoggingConfigurator.h" #include "Poco/Util/SystemConfiguration.h" @@ -15,20 +15,20 @@ namespace Mantid namespace Kernel { // Initialise the instance pointer to zero - ConfigSvc* ConfigSvc::m_instance=0; + ConfigService* ConfigService::m_instance=0; - /** A static method which retrieves the single instance of the ConfigSvc + /** A static method which retrieves the single instance of the ConfigService * * @returns A pointer to the instance */ - ConfigSvc* ConfigSvc::Instance() + ConfigService* ConfigService::Instance() { - if (!m_instance) m_instance = new ConfigSvc; + if (!m_instance) m_instance = new ConfigService; return m_instance; } /// Private constructor for singleton class - ConfigSvc::ConfigSvc() + ConfigService::ConfigService() { //getting at system details m_pSysConfig = new WrappedObject<Poco::Util::SystemConfiguration>; @@ -40,7 +40,7 @@ namespace Kernel /** Private Destructor * Prevents client from calling 'delete' on the pointer handed out by Instance */ - ConfigSvc::~ConfigSvc() + ConfigService::~ConfigService() { delete m_pSysConfig; delete m_pConf; // potential double delete??? @@ -52,7 +52,7 @@ namespace Kernel * * @param filename The filename and optionally path of the file to load */ - void ConfigSvc::loadConfig(const std::string& filename) + void ConfigService::loadConfig(const std::string& filename) { delete m_pConf; @@ -89,7 +89,7 @@ namespace Kernel //configure the logging framework Poco::Util::LoggingConfigurator configurator; - //BUG? This line crashes the FrameworkManagerTest and ConfigSvcTest + //BUG? This line crashes the FrameworkManagerTest and ConfigServiceTest configurator.configure(m_pConf); } catch (std::exception& e) @@ -104,7 +104,7 @@ namespace Kernel * @param keyName The case sensitive name of the property that you need the value of. * @returns The string value of the property */ - std::string ConfigSvc::getString(const std::string& keyName) + std::string ConfigService::getString(const std::string& keyName) { return m_pConf->getString(keyName); } @@ -117,7 +117,7 @@ namespace Kernel * @returns A success flag - 0 on failure, 1 on success */ template<typename T> - int ConfigSvc::getValue(const std::string& keyName, T& out) + int ConfigService::getValue(const std::string& keyName, T& out) { std::string strValue = getString(keyName); int result = StrFunc::convert(strValue,out); @@ -130,7 +130,7 @@ namespace Kernel * @param keyName The name of the environment variable that you need the value of. * @returns The string value of the property */ - std::string ConfigSvc::getEnvironment(const std::string& keyName) + std::string ConfigService::getEnvironment(const std::string& keyName) { return m_pSysConfig->getString("system.env." + keyName); } @@ -139,7 +139,7 @@ namespace Kernel * * @returns The name pf the OS version */ - std::string ConfigSvc::getOSName() + std::string ConfigService::getOSName() { return m_pSysConfig->getString("system.osName"); } @@ -148,7 +148,7 @@ namespace Kernel * * @returns The name of the computer */ - std::string ConfigSvc::getOSArchitecture() + std::string ConfigService::getOSArchitecture() { return m_pSysConfig->getString("system.osArchitecture"); } @@ -157,7 +157,7 @@ namespace Kernel * * @returns The operating system architecture */ - std::string ConfigSvc::getComputerName() + std::string ConfigService::getComputerName() { return m_pSysConfig->getString("system.nodeName"); } @@ -166,7 +166,7 @@ namespace Kernel * * @returns The operating system version */ - std::string ConfigSvc::getOSVersion() + std::string ConfigService::getOSVersion() { return m_pSysConfig->getString("system.osVersion"); } @@ -175,7 +175,7 @@ namespace Kernel * * @returns The absolute path of the current directory containing the dll */ - std::string ConfigSvc::getCurrentDir() + std::string ConfigService::getCurrentDir() { return m_pSysConfig->getString("system.currentDir"); } @@ -184,7 +184,7 @@ namespace Kernel * * @returns The absolute path of the home directory */ - std::string ConfigSvc::getHomeDir() + std::string ConfigService::getHomeDir() { return m_pSysConfig->getString("system.homeDir"); } @@ -193,7 +193,7 @@ namespace Kernel * * @returns The absolute path of the temp directory */ - std::string ConfigSvc::getTempDir() + std::string ConfigService::getTempDir() { return m_pSysConfig->getString("system.tempDir"); } @@ -202,9 +202,9 @@ namespace Kernel /// \cond TEMPLATE - template DLLExport int ConfigSvc::getValue(const std::string&,double&); - template DLLExport int ConfigSvc::getValue(const std::string&,std::string&); - template DLLExport int ConfigSvc::getValue(const std::string&,int&); + template DLLExport int ConfigService::getValue(const std::string&,double&); + template DLLExport int ConfigService::getValue(const std::string&,std::string&); + template DLLExport int ConfigService::getValue(const std::string&,int&); /// \endcond TEMPLATE diff --git a/Code/Mantid/Kernel/src/FrameworkManager.cpp b/Code/Mantid/Kernel/src/FrameworkManager.cpp index 149455d95c5..67e0e4ef7d0 100644 --- a/Code/Mantid/Kernel/src/FrameworkManager.cpp +++ b/Code/Mantid/Kernel/src/FrameworkManager.cpp @@ -5,7 +5,7 @@ #include "AlgorithmManager.h" #include "WorkspaceFactory.h" #include "AnalysisDataService.h" -#include "ConfigSvc.h" +#include "ConfigService.h" #include "IAlgorithm.h" #include "Exception.h" @@ -40,7 +40,7 @@ void FrameworkManager::initialize() { // Required services are: the config service, the algorithm manager // the analysis data service, the workspace factory - config = ConfigSvc::Instance(); + config = ConfigService::Instance(); algManager = AlgorithmManager::Instance(); workFactory = WorkspaceFactory::Instance(); data = AnalysisDataService::Instance(); diff --git a/Code/Mantid/Kernel/test/ConfigSvcTest.h b/Code/Mantid/Kernel/test/ConfigServiceTest.h similarity index 90% rename from Code/Mantid/Kernel/test/ConfigSvcTest.h rename to Code/Mantid/Kernel/test/ConfigServiceTest.h index 5b68725887c..3b3b107562f 100644 --- a/Code/Mantid/Kernel/test/ConfigSvcTest.h +++ b/Code/Mantid/Kernel/test/ConfigServiceTest.h @@ -1,22 +1,22 @@ -#ifndef MANTID_CONFIGSVCTEST_H_ -#define MANTID_CONFIGSVCTEST_H_ +#ifndef MANTID_CONFIGSERVICETEST_H_ +#define MANTID_CONFIGSERVICETEST_H_ #include <cxxtest/TestSuite.h> -#include "../inc/ConfigSvc.h" +#include "../inc/ConfigService.h" #include "../inc/Logger.h" #include <string> #include <iostream> using namespace Mantid::Kernel; -class ConfigSvcTest : public CxxTest::TestSuite +class ConfigServiceTest : public CxxTest::TestSuite { public: - ConfigSvcTest() + ConfigServiceTest() { - configSvc = ConfigSvc::Instance(); + configSvc = ConfigService::Instance(); configSvc->loadConfig("MantidTest.properties"); } @@ -86,7 +86,7 @@ public: private: - ConfigSvc *configSvc; + ConfigService *configSvc; }; -#endif /*MANTID_CONFIGSVCTEST_H_*/ +#endif /*MANTID_CONFIGSERVICETEST_H_*/ diff --git a/Code/Mantid/Kernel/test/runTests.bat b/Code/Mantid/Kernel/test/runTests.bat index 33cc5f4e027..c48d5ad8096 100644 --- a/Code/Mantid/Kernel/test/runTests.bat +++ b/Code/Mantid/Kernel/test/runTests.bat @@ -1,5 +1,5 @@ @echo off -REM IF "%VCINSTALLDIR%"=="" SET PATH=%path%;C:\Mantid\Code\Third_Party\lib\win32 +IF "%VCINSTALLDIR%"=="" SET PATH=%CD%\..\..\..\Third_Party\lib\win32;%CD%\..\..\Debug;%PATH% IF "%VCINSTALLDIR%"=="" CALL "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" REM Simple script to build and run the tests. REM Have kept separate from the makefile since that's automatically generated @@ -24,10 +24,6 @@ echo "Compiling the test executable..." cl runner.cpp /I "..\..\..\Third_Party\include" /I "..\.." /EHsc /MDd /W3 /nologo /c /ZI /TP link /OUT:"runner.exe" /NOLOGO /LIBPATH:"../../Debug" /LIBPATH:"../../../Third_Party/lib/win32" /DEBUG /PDB:".\runner.pdb" kernel.lib runner.obj - -echo "Copying in required dlls..." -copy ..\..\..\Third_Party\lib\win32\*.dll . -copy ..\..\debug\*.dll . echo "Running the tests..." runner.exe @@ -38,7 +34,6 @@ echo "Cleaning up..." del runner.cpp del *.obj del *.pdb -del *.dll del runner.lib del runner.ilk del runner.exp -- GitLab