Mantid
Loading...
Searching...
No Matches
Framework
API
inc
MantidAPI
AlgorithmFactoryObserver.h
Go to the documentation of this file.
1
// Mantid Repository : https://github.com/mantidproject/mantid
2
//
3
// Copyright © 2019 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 +
7
#pragma once
8
9
#include "
MantidAPI/AlgorithmFactory.h
"
10
#include <Poco/NObserver.h>
11
12
namespace
Mantid
{
13
namespace
API
{
14
15
/*
16
* To use the AlgorithmFactoryObserver you will need to do a few things:
17
*
18
* 1. Inherit from this class in the class you wish to take effect on
19
*
20
* 2. Make sure that the effect you are attempting to observe has been added
21
* to the AlgorithmFactory itself by using the public method in this
22
* class, e.g. observeSubscribe
23
*
24
* 3. The last thing to actually have something take effect is by overriding
25
* the relevant handle function e.g. when observing subscriptions override
26
* subscribeHandle and anything done in that overridden method will happen
27
* every time something is subscribed to AlgorithmFactory.
28
*
29
* This works in both C++ and Python, some functionality is limited in
30
* python, but the handlers will all be called.
31
*/
32
33
class
MANTID_API_DLL
AlgorithmFactoryObserver
{
34
public
:
35
AlgorithmFactoryObserver
();
36
virtual
~AlgorithmFactoryObserver
();
37
38
void
observeUpdate(
bool
turnOn =
true
);
39
40
virtual
void
updateHandle();
41
42
private
:
43
bool
m_observingUpdate{
false
};
44
45
void
_updateHandle(
AlgorithmFactoryUpdateNotification_ptr
pNf);
46
48
Poco::NObserver<AlgorithmFactoryObserver, AlgorithmFactoryUpdateNotification>
m_updateObserver
;
49
};
50
51
}
// namespace API
52
}
// namespace Mantid
AlgorithmFactory.h
Mantid::API::AlgorithmFactoryObserver
Definition:
AlgorithmFactoryObserver.h:33
Mantid::API::AlgorithmFactoryObserver::m_updateObserver
Poco::NObserver< AlgorithmFactoryObserver, AlgorithmFactoryUpdateNotification > m_updateObserver
Poco::NObserver for SubscribeNotification.
Definition:
AlgorithmFactoryObserver.h:48
Poco::NObserver
Definition:
Algorithm.h:34
API
Definition:
ChudleyElliotSQE.h:16
Mantid::API::AlgorithmFactoryUpdateNotification_ptr
const Poco::AutoPtr< Mantid::Kernel::DynamicFactory< Algorithm >::UpdateNotification > & AlgorithmFactoryUpdateNotification_ptr
Definition:
AlgorithmFactory.h:169
Mantid
Helper class which provides the Collimation Length for SANS instruments.
Definition:
AbsorptionCorrection.h:18
Generated on Tue Jan 3 2023 11:57:22 for Mantid by
1.9.5