Mantid
|
The ConfigObserver is used to observe changes in the configuration based on notifications sent from the ConfigService. More...
#include <ConfigObserver.h>
Public Member Functions | |
ConfigObserver () | |
Begins listening to notifications from the global ConfigService. More... | |
ConfigObserver (const ConfigObserver &other) | |
Copying a config observer is the same as default constructing one. More... | |
void | notifyValueChanged (ConfigValChangeNotification_ptr notification) |
Called when a config property's value is changed. More... | |
void | notifyValueChanged (const std::string &name, const std::string &newValue, const std::string &prevValue) |
Called when a config property's value is changed. More... | |
ConfigObserver & | operator= (const ConfigObserver &other) |
Nothing to do but we must overload the = operator to prevent a default copy which would produce incorrect results. More... | |
virtual | ~ConfigObserver () noexcept |
Protected Member Functions | |
virtual void | onValueChanged (const std::string &name, const std::string &newValue, const std::string &prevValue)=0 |
Private Attributes | |
Poco::NObserver< ConfigObserver, Mantid::Kernel::ConfigValChangeNotification > | m_valueChangeListener |
The ConfigObserver is used to observe changes in the configuration based on notifications sent from the ConfigService.
Definition at line 17 of file ConfigObserver.h.
Mantid::Kernel::ConfigObserver::ConfigObserver | ( | ) |
Begins listening to notifications from the global ConfigService.
Definition at line 15 of file ConfigObserver.cpp.
References Mantid::Kernel::SingletonHolder< T >::Instance(), and m_valueChangeListener.
Mantid::Kernel::ConfigObserver::ConfigObserver | ( | const ConfigObserver & | other | ) |
Copying a config observer is the same as default constructing one.
It is necessary to create a new listener object with the this pointer in order for the correct object to recieve the notification.
other | The observer to copy. |
Definition at line 27 of file ConfigObserver.cpp.
References Mantid::Kernel::SingletonHolder< T >::Instance(), m_valueChangeListener, and UNUSED_ARG.
|
virtualnoexcept |
Definition at line 48 of file ConfigObserver.cpp.
References Mantid::Kernel::SingletonHolder< T >::Instance(), and m_valueChangeListener.
void Mantid::Kernel::ConfigObserver::notifyValueChanged | ( | ConfigValChangeNotification_ptr | notification | ) |
Called when a config property's value is changed.
notification | The Poco notification object. |
Definition at line 67 of file ConfigObserver.cpp.
References notifyValueChanged().
void Mantid::Kernel::ConfigObserver::notifyValueChanged | ( | const std::string & | name, |
const std::string & | newValue, | ||
const std::string & | oldValue | ||
) |
Called when a config property's value is changed.
name | The name of the property which changed. |
newValue | The new value of the property. |
oldValue | The old value of the property. |
Definition at line 57 of file ConfigObserver.cpp.
References onValueChanged().
Referenced by notifyValueChanged().
|
protectedpure virtual |
Implemented in Mantid::Kernel::ConfigPropertyObserver, and ConfigObserverWrapper.
Referenced by notifyValueChanged().
ConfigObserver & Mantid::Kernel::ConfigObserver::operator= | ( | const ConfigObserver & | other | ) |
Nothing to do but we must overload the = operator to prevent a default copy which would produce incorrect results.
We don't need to re-register with the ConfigService since it is not possible to create a ConfigObserver which is unregistered and we only ever unregister in the destructor.
other | The observer to copy. |
Definition at line 43 of file ConfigObserver.cpp.
References UNUSED_ARG.
|
private |
Definition at line 31 of file ConfigObserver.h.
Referenced by ConfigObserver(), and ~ConfigObserver().