Newer
Older
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
27
28
29
30
31
32
33
34
35
36
37
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2007 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidAPI/AnalysisDataServiceObserver.h"
AnalysisDataServiceObserver::AnalysisDataServiceObserver()
: m_addObserver(*this, &AnalysisDataServiceObserver::_addHandle) {}
AnalysisDataServiceObserver::~AnalysisDataServiceObserver(){
// Turn off/remove all observers
this->observeAll(false);
}
void AnalysisDataServiceObserver::observeAll(bool turnOn) {
this->observeAdd(turnOn);
}
void AnalysisDataServiceObserver::observeAdd(bool turnOn) {
if (turnOn && !m_observingAdd) {
AnalysisDataService::Instance().notificationCenter.addObserver(
m_addObserver);
} else if (!turnOn && m_observingAdd) {
AnalysisDataService::Instance().notificationCenter.removeObserver(
m_addObserver);
}
m_observingAdd = turnOn;
}
void AnalysisDataServiceObserver::addHandle(
const std::string &wsName, const Mantid::API::Workspace_sptr ws) {
UNUSED_ARG(wsName)
UNUSED_ARG(ws)
}