12#include "MantidKernel/DllConfig.h"
15#include <boost/optional/optional.hpp>
22#include <Poco/Notification.h>
23#include <Poco/NotificationCenter.h>
30class AbstractObserver;
32template <
class C>
class AutoPtr;
34class PropertyFileConfiguration;
35class SystemConfiguration;
88 ValueChanged(
const std::string &name,
const std::string &newvalue,
const std::string &prevvalue)
92 const std::string &
key()
const {
return this->m_name; }
96 const std::string &
preValue()
const {
return this->m_prev; }
104 void setBaseDirectory();
108 void updateConfig(
const std::string &filename,
const bool append =
false,
const bool update_caches =
true);
110 void saveConfig(
const std::string &filename)
const;
112 std::string getString(
const std::string &keyName,
bool pathAbsolute =
true)
const;
114 std::vector<std::string> getKeys(
const std::string &keyName)
const;
116 std::vector<std::string> keys()
const;
118 void remove(
const std::string &rootName);
120 bool hasProperty(
const std::string &rootName)
const;
122 bool isExecutable(
const std::string &target)
const;
124 void launchProcess(
const std::string &programFilePath,
const std::vector<std::string> &programArguments)
const;
126 void setString(
const std::string &key,
const std::string &
value);
128 template <
typename T> boost::optional<T> getValue(
const std::string &keyName);
130 std::string getLocalFilename()
const;
132 std::string getUserFilename()
const;
137 std::string getEnvironment(
const std::string &keyName);
139 std::string getOSName();
141 std::string getComputerName();
143 std::string getOSArchitecture();
145 std::string getOSVersion();
147 std::string getOSVersionReadable();
149 std::string getUsername();
151 std::string getCurrentDir();
153 std::string getCurrentDir()
const;
155 std::string getTempDir();
157 std::string getAppDataDir();
159 std::string getDirectoryOfExecutable()
const;
161 std::string getPathToExecutable()
const;
163 bool isNetworkDrive([[maybe_unused]]
const std::string &path);
167 std::string getPropertiesDir()
const;
170 std::string getUserPropertiesDir()
const;
175 const std::vector<std::string> &getDataSearchDirs()
const;
177 void setDataSearchDirs(
const std::vector<std::string> &searchDirs);
179 void setDataSearchDirs(
const std::string &searchDirs);
181 void appendDataSearchDir(
const std::string &path);
183 void appendDataSearchSubDir(
const std::string &subdir);
185 void setInstrumentDirectories(
const std::vector<std::string> &directories);
187 const std::vector<std::string> &getInstrumentDirectories()
const;
189 const std::string getInstrumentDirectory()
const;
191 const std::string getVTPFileDirectory();
195 void updateFacilities(
const std::string &fName =
"");
197 const std::vector<FacilityInfo *> getFacilities()
const;
199 const std::vector<std::string> getFacilityNames()
const;
203 const FacilityInfo &getFacility(
const std::string &facilityName)
const;
205 void setFacility(
const std::string &facilityName);
207 void setLogLevel(
int logLevel,
bool quiet =
false);
210 const InstrumentInfo &getInstrument(
const std::string &instrumentName =
"")
const;
213 void addObserver(
const Poco::AbstractObserver &observer)
const;
216 void removeObserver(
const Poco::AbstractObserver &observer)
const;
219 void configureLogging();
224 std::string getFullPath(
const std::string &filename,
const bool ignoreDirs,
const int options)
const;
239 void loadConfig(
const std::string &filename,
const bool append =
false);
241 bool readFile(
const std::string &filename, std::string &contents)
const;
244 void createUserPropertiesFile()
const;
246 std::string makeAbsolute(
const std::string &dir,
const std::string &key)
const;
248 void cacheDataSearchPaths();
250 void cacheInstrumentPaths();
252 bool isInDataSearchList(
const std::string &path)
const;
255 void clearFacilities();
257 const std::vector<std::string> getFacilityFilenames(
const std::string &fName);
260 bool addDirectoryifExists(
const std::string &directoryName, std::vector<std::string> &directoryList);
262 void getKeysRecursive(
const std::string &root, std::vector<std::string> &allKeys)
const;
265 Poco::AutoPtr<Poco::Util::PropertyFileConfiguration>
m_pConf;
const std::string & m_value
double value
The value of the point.
This is the base class for POCO Notifications sent out from the Config Service.
ConfigServiceNotification()
Empty constructor for ConfigServiceNotification Base Class.
This is the class for the notification that is to be sent when a value has been changed in config ser...
std::string m_name
The name of the changed the property.
ValueChanged(const std::string &name, const std::string &newvalue, const std::string &prevvalue)
Creates the Notification object with the required values.
std::string m_prev
The previous value for the property.
std::string m_value
The new value for the property.
const std::string & curValue() const
The new value for the property.
const std::string & key() const
The name of the user property that has changed, as it appears in the user.properties file.
const std::string & preValue() const
The previous value for the property.
The ConfigService class provides a simple facade to access the Configuration functionality of the Man...
std::string m_propertyString
The configuration properties in string format.
const std::string m_properties_file_name
The filename of the Mantid properties file.
std::set< std::string > m_configPaths
List of config paths that may be relative.
std::string m_strBaseDir
The directory that is considered to be the base directory.
std::set< std::string > m_changed_keys
A set of property keys that have been changed.
std::vector< std::string > m_dataSearchDirs
Store a list of data search paths.
ConfigServiceImpl(const ConfigServiceImpl &)
Private copy constructor. Prevents singleton being copied.
Poco::AutoPtr< Poco::Util::SystemConfiguration > m_pSysConfig
the POCO system Config Object
bool m_isProxySet
whether the proxy has been populated yet
Poco::NotificationCenter m_notificationCenter
Handles distribution of Poco signals.
Kernel::ProxyInfo m_proxyInfo
local cache of proxy details
const std::string m_user_properties_file_name
The filename of the Mantid user properties file.
Poco::AutoPtr< Poco::Util::PropertyFileConfiguration > m_pConf
the POCO file config object
std::vector< FacilityInfo * > m_facilities
The list of available facilities.
std::vector< std::string > m_instrumentDirs
Store a list of instrument directory paths.
A class that holds information about a facility.
A class that holds information about an instrument.
ProxyInfo : Container for carrying around network proxy information.
Manage the lifetime of a class intended to be a singleton.
const Poco::AutoPtr< Mantid::Kernel::ConfigServiceImpl::ValueChanged > & ConfigValChangeNotification_ptr
Helper class which provides the Collimation Length for SANS instruments.
MANTID_KERNEL_DLL std::string welcomeMessage()
Returns the welcome message for Mantid.
Policy class controlling creation of the singleton Implementation classes should mark their default c...