Mantid
Loading...
Searching...
No Matches
ConfigObserver.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
10
11namespace Mantid::Kernel {
15ConfigObserver::ConfigObserver() : m_valueChangeListener(*this, &ConfigObserver::notifyValueChanged) {
17}
18
28 : m_valueChangeListener(*this, &ConfigObserver::notifyValueChanged) {
29 UNUSED_ARG(other);
31}
32
44 UNUSED_ARG(other);
45 return *this;
46}
47
49
57void ConfigObserver::notifyValueChanged(const std::string &name, const std::string &newValue,
58 const std::string &oldValue) {
59 onValueChanged(name, newValue, oldValue);
60}
61
68 notifyValueChanged(notification->key(), notification->curValue(), notification->preValue());
69}
70} // namespace Mantid::Kernel
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
Definition: System.h:64
The ConfigObserver is used to observe changes in the configuration based on notifications sent from t...
ConfigObserver & operator=(const ConfigObserver &other)
Nothing to do but we must overload the = operator to prevent a default copy which would produce incor...
void notifyValueChanged(const std::string &name, const std::string &newValue, const std::string &prevValue)
Called when a config property's value is changed.
virtual ~ConfigObserver() noexcept
virtual void onValueChanged(const std::string &name, const std::string &newValue, const std::string &prevValue)=0
Poco::NObserver< ConfigObserver, Mantid::Kernel::ConfigValChangeNotification > m_valueChangeListener
ConfigObserver()
Begins listening to notifications from the global ConfigService.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
const Poco::AutoPtr< Mantid::Kernel::ConfigServiceImpl::ValueChanged > & ConfigValChangeNotification_ptr