Mantid
Loading...
Searching...
No Matches
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
10#include <Poco/NObserver.h>
11
12namespace Mantid {
13namespace 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
33class MANTID_API_DLL AlgorithmFactoryObserver {
34public:
37
38 void observeUpdate(bool turnOn = true);
39
40 virtual void updateHandle();
41
42private:
43 bool m_observingUpdate{false};
44
45 void _updateHandle(AlgorithmFactoryUpdateNotification_ptr pNf);
46
49};
50
51} // namespace API
52} // namespace Mantid
Poco::NObserver< AlgorithmFactoryObserver, AlgorithmFactoryUpdateNotification > m_updateObserver
Poco::NObserver for SubscribeNotification.
const Poco::AutoPtr< Mantid::Kernel::DynamicFactory< Algorithm >::UpdateNotification > & AlgorithmFactoryUpdateNotification_ptr
Helper class which provides the Collimation Length for SANS instruments.