Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Mantid::Kernel::ConfigObserver Class Referenceabstract

The ConfigObserver is used to observe changes in the configuration based on notifications sent from the ConfigService. More...

#include <ConfigObserver.h>

Inheritance diagram for Mantid::Kernel::ConfigObserver:
ConfigObserverWrapper Mantid::Kernel::ConfigPropertyObserver ConfigPropertyObserverWrapper

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...
 
ConfigObserveroperator= (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::ConfigValChangeNotificationm_valueChangeListener
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ConfigObserver() [1/2]

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.

◆ ConfigObserver() [2/2]

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.

Parameters
otherThe observer to copy.

Definition at line 27 of file ConfigObserver.cpp.

References Mantid::Kernel::SingletonHolder< T >::Instance(), m_valueChangeListener, and UNUSED_ARG.

◆ ~ConfigObserver()

Mantid::Kernel::ConfigObserver::~ConfigObserver ( )
virtualnoexcept

Member Function Documentation

◆ notifyValueChanged() [1/2]

void Mantid::Kernel::ConfigObserver::notifyValueChanged ( ConfigValChangeNotification_ptr  notification)

Called when a config property's value is changed.

Parameters
notificationThe Poco notification object.

Definition at line 67 of file ConfigObserver.cpp.

References notifyValueChanged().

◆ notifyValueChanged() [2/2]

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.

Parameters
nameThe name of the property which changed.
newValueThe new value of the property.
oldValueThe old value of the property.

Definition at line 57 of file ConfigObserver.cpp.

References onValueChanged().

Referenced by notifyValueChanged().

◆ onValueChanged()

virtual void Mantid::Kernel::ConfigObserver::onValueChanged ( const std::string &  name,
const std::string &  newValue,
const std::string &  prevValue 
)
protectedpure virtual

◆ operator=()

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.

Parameters
otherThe observer to copy.

Definition at line 43 of file ConfigObserver.cpp.

References UNUSED_ARG.

Member Data Documentation

◆ m_valueChangeListener

Poco::NObserver<ConfigObserver, Mantid::Kernel::ConfigValChangeNotification> Mantid::Kernel::ConfigObserver::m_valueChangeListener
private

Definition at line 31 of file ConfigObserver.h.

Referenced by ConfigObserver(), and ~ConfigObserver().


The documentation for this class was generated from the following files: