forked from npshub/mantid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConfigPropertyObserver.cpp
26 lines (23 loc) · 1.03 KB
/
ConfigPropertyObserver.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidKernel/ConfigPropertyObserver.h"
#include "MantidKernel/ConfigService.h"
namespace Mantid::Kernel {
/**
* Begins listening for change notifications from the global ConfigService
* concerning the property with the specified name.
*/
ConfigPropertyObserver::ConfigPropertyObserver(std::string propertyName) : m_propertyName(std::move(propertyName)) {}
/**
* Filters out change notifications concerning other properties.
*/
void ConfigPropertyObserver::onValueChanged(const std::string &name, const std::string &newValue,
const std::string &prevValue) {
if (name == m_propertyName)
onPropertyValueChanged(newValue, prevValue);
}
} // namespace Mantid::Kernel