Skip to content
Snippets Groups Projects
Commit f68c44e8 authored by Nick Draper's avatar Nick Draper
Browse files

Renamed configsvc to ConfigService

re #47
parent 03223d8b
No related branches found
No related tags found
No related merge requests found
@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
......
@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
......
......@@ -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
......
#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_*/
......@@ -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;
};
......
//----------------------------------------------------------------------
// 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
......
......@@ -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();
......
#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_*/
@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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment