Mantid
Loading...
Searching...
No Matches
LiveListenerFactory.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2012 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/* Used to register unit classes into the factory. creates a global object in an
10 * anonymous namespace. The object itself does nothing, but the comma operator
11 * is used in the call to its constructor to effect a call to the factory's
12 * subscribe method.
13 *
14 * The second operation that this macro performs is to provide the definition
15 * of the unitID method for the concrete unit.
16 */
17#define DECLARE_LISTENER(classname) \
18 namespace { \
19 Mantid::Kernel::RegistrationHelper register_listener_##classname( \
20 ((Mantid::API::LiveListenerFactory::Instance().subscribe<classname>(#classname)), 0)); \
21 }
22
23//----------------------------------------------------------------------
24// Includes
25//----------------------------------------------------------------------
26#include "MantidAPI/DllConfig.h"
31
32namespace Mantid {
33namespace API {
34class IAlgorithm;
37class MANTID_API_DLL LiveListenerFactoryImpl : public Kernel::DynamicFactory<ILiveListener> {
38public:
39 std::shared_ptr<ILiveListener> create(const std::string &instrumentName, bool connect = false,
40 const API::IAlgorithm *callingAlgorithm = nullptr,
41 const std::string &listenerConnectionName = "") const;
42
43 std::shared_ptr<ILiveListener> create(const Kernel::LiveListenerInfo &info, bool connect = false,
44 const API::IAlgorithm *callingAlgorithm = nullptr) const;
45
48
49private:
51
54
56 ~LiveListenerFactoryImpl() override = default;
57
58 // Unhide the base class method to avoid a warning, but make private.
62 ILiveListener *createUnwrapped(const std::string &className) const override;
63};
64
66
67} // namespace API
68} // namespace Mantid
69
70namespace Mantid {
71namespace Kernel {
72EXTERN_MANTID_API template class MANTID_API_DLL Kernel::SingletonHolder<Mantid::API::LiveListenerFactoryImpl>;
73}
74} // namespace Mantid
IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:45
ILiveListener is the interface implemented by classes which connect directly to instrument data acqui...
Definition: ILiveListener.h:31
The factory for creating instances of ILiveListener implementations.
LiveListenerFactoryImpl()=default
Private constructor for singleton class.
~LiveListenerFactoryImpl() override=default
Private destructor.
LiveListenerFactoryImpl(const LiveListenerFactoryImpl &)=delete
The dynamic factory is a base dynamic factory for serving up objects in response to requests from oth...
A class that holds information about a LiveListener connection.
Manage the lifetime of a class intended to be a singleton.
std::unique_ptr< T > create(const P &parent, const IndexArg &indexArg, const HistArg &histArg)
This is the create() method that all the other create() methods call.
Helper class which provides the Collimation Length for SANS instruments.
Policy class controlling creation of the singleton Implementation classes should mark their default c...