Mantid
|
The factory for creating instances of ILiveListener implementations. More...
#include <LiveListenerFactory.h>
Public Member Functions | |
std::shared_ptr< ILiveListener > | create (const Kernel::LiveListenerInfo &info, bool connect=false, const API::IAlgorithm *callingAlgorithm=nullptr) const |
Creates an instance of a specific LiveListener based on the given LiveListenerInfo instance. More... | |
std::shared_ptr< ILiveListener > | create (const std::string &instrumentName, bool connect=false, const API::IAlgorithm *callingAlgorithm=nullptr, const std::string &listenerConnectionName="") const |
Creates an instance of the appropriate listener for the given instrument, and establishes the connection to the data acquisition. More... | |
LiveListenerFactoryImpl (const LiveListenerFactoryImpl &)=delete | |
LiveListenerFactoryImpl & | operator= (const LiveListenerFactoryImpl &)=delete |
Public Member Functions inherited from Mantid::Kernel::DynamicFactory< ILiveListener > | |
virtual std::shared_ptr< ILiveListener > | create (const std::string &className) const |
Creates a new instance of the class with the given name. More... | |
virtual ILiveListener * | createUnwrapped (const std::string &className) const |
Creates a new instance of the class with the given name, which is not wrapped in a boost shared_ptr. More... | |
void | disableNotifications () |
Disable notifications. More... | |
DynamicFactory (const DynamicFactory &)=delete | |
void | enableNotifications () |
Enable notifications. More... | |
bool | exists (const std::string &className) const |
Returns true if the given class is currently registered. More... | |
virtual const std::vector< std::string > | getKeys () const |
Returns the keys in the map. More... | |
DynamicFactory & | operator= (const DynamicFactory &)=delete |
void | subscribe (const std::string &className) |
Registers the instantiator for the given class with the DynamicFactory. More... | |
void | subscribe (const std::string &className, std::unique_ptr< AbstractFactory > pAbstractFactory, SubscribeAction replace=ErrorIfExists) |
Registers the instantiator for the given class with the DynamicFactory. More... | |
void | unsubscribe (const std::string &className) |
Unregisters the given class and deletes the instantiator for the class. More... | |
virtual | ~DynamicFactory ()=default |
Destroys the DynamicFactory and deletes the instantiators for all registered classes. More... | |
Private Member Functions | |
ILiveListener * | createUnwrapped (const std::string &className) const override |
Override the DynamicFactory::createUnwrapped() method. More... | |
LiveListenerFactoryImpl ()=default | |
Private constructor for singleton class. More... | |
~LiveListenerFactoryImpl () override=default | |
Private destructor. More... | |
Friends | |
struct | Kernel::CreateUsingNew< LiveListenerFactoryImpl > |
Additional Inherited Members | |
Public Types inherited from Mantid::Kernel::DynamicFactory< ILiveListener > | |
using | AbstractFactory = AbstractInstantiator< ILiveListener > |
A typedef for the instantiator. More... | |
enum | NotificationStatus |
Defines the whether notifications are dispatched. More... | |
enum | SubscribeAction |
Defines replacement behaviour. More... | |
Public Attributes inherited from Mantid::Kernel::DynamicFactory< ILiveListener > | |
Poco::NotificationCenter | notificationCenter |
Sends notifications to observers. More... | |
Protected Member Functions inherited from Mantid::Kernel::DynamicFactory< ILiveListener > | |
DynamicFactory () | |
Protected constructor for base class. More... | |
The factory for creating instances of ILiveListener implementations.
Definition at line 37 of file LiveListenerFactory.h.
|
delete |
|
privatedefault |
Private constructor for singleton class.
|
overrideprivatedefault |
Private destructor.
std::shared_ptr< ILiveListener > Mantid::API::LiveListenerFactoryImpl::create | ( | const Kernel::LiveListenerInfo & | info, |
bool | connect = false , |
||
const API::IAlgorithm * | callingAlgorithm = nullptr |
||
) | const |
Creates an instance of a specific LiveListener based on the given LiveListenerInfo instance.
The only required data from LiveListenerInfo is the listener class name. If connect is set to true, a valid address is also required.
info | LiveListenerInfo based on which to create the LiveListener |
connect | Whether to connect the listener to the data stream for the given instrument. |
callingAlgorithm | reference to calling algorithm if it has any. |
Definition at line 70 of file LiveListenerFactory.cpp.
References Mantid::Kernel::LiveListenerInfo::address(), Mantid::Kernel::DynamicFactory< Base, Comparator >::create(), Mantid::Kernel::Logger::debug(), Mantid::API::g_log, and Mantid::Kernel::LiveListenerInfo::listener().
std::shared_ptr< ILiveListener > Mantid::API::LiveListenerFactoryImpl::create | ( | const std::string & | instrumentName, |
bool | connect = false , |
||
const API::IAlgorithm * | callingAlgorithm = nullptr , |
||
const std::string & | listenerConnectionName = "" |
||
) | const |
Creates an instance of the appropriate listener for the given instrument, and establishes the connection to the data acquisition.
instrumentName | The name of the instrument to 'listen to' (Note that the argument has different semantics to the base class create method). |
connect | Whether to connect the listener to the data stream for the given instrument. |
callingAlgorithm | reference to calling algorithm |
listenerConnectionName | Name of LiveListenerInfo connection to use. |
Exception::NotFoundError | If the requested listener is not registered |
std::runtime_error | If unable to connect to the listener at the configured address. |
Definition at line 37 of file LiveListenerFactory.cpp.
References create(), and Mantid::Kernel::SingletonHolder< T >::Instance().
Referenced by create().
|
overrideprivatevirtual |
Override the DynamicFactory::createUnwrapped() method.
We don't want it used here.
We don't want it used here. Making it private will prevent most accidental usage, though of course this could be called through a DynamicFactory pointer or reference.
className | Argument that's ignored |
Exception::NotImplementedError | every time! |
Reimplemented from Mantid::Kernel::DynamicFactory< ILiveListener >.
Definition at line 118 of file LiveListenerFactory.cpp.
References UNUSED_ARG.
|
delete |
|
friend |
Definition at line 47 of file LiveListenerFactory.h.