Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Friends | List of all members
Mantid::API::LiveListenerFactoryImpl Class Reference

The factory for creating instances of ILiveListener implementations. More...

#include <LiveListenerFactory.h>

Inheritance diagram for Mantid::API::LiveListenerFactoryImpl:
Mantid::Kernel::DynamicFactory< ILiveListener >

Public Member Functions

std::shared_ptr< ILiveListenercreate (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< ILiveListenercreate (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
 
LiveListenerFactoryImploperator= (const LiveListenerFactoryImpl &)=delete
 
- Public Member Functions inherited from Mantid::Kernel::DynamicFactory< ILiveListener >
virtual std::shared_ptr< ILiveListenercreate (const std::string &className) const
 Creates a new instance of the class with the given name. More...
 
virtual ILiveListenercreateUnwrapped (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...
 
DynamicFactoryoperator= (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

ILiveListenercreateUnwrapped (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...
 

Detailed Description

The factory for creating instances of ILiveListener implementations.

Definition at line 37 of file LiveListenerFactory.h.

Constructor & Destructor Documentation

◆ LiveListenerFactoryImpl() [1/2]

Mantid::API::LiveListenerFactoryImpl::LiveListenerFactoryImpl ( const LiveListenerFactoryImpl )
delete

◆ LiveListenerFactoryImpl() [2/2]

Mantid::API::LiveListenerFactoryImpl::LiveListenerFactoryImpl ( )
privatedefault

Private constructor for singleton class.

◆ ~LiveListenerFactoryImpl()

Mantid::API::LiveListenerFactoryImpl::~LiveListenerFactoryImpl ( )
overrideprivatedefault

Private destructor.

Member Function Documentation

◆ create() [1/2]

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.

Parameters
infoLiveListenerInfo based on which to create the LiveListener
connectWhether to connect the listener to the data stream for the given instrument.
callingAlgorithmreference to calling algorithm if it has any.
Returns
A shared pointer to the created ILiveListener implementation

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().

◆ create() [2/2]

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.

Parameters
instrumentNameThe name of the instrument to 'listen to' (Note that the argument has different semantics to the base class create method).
connectWhether to connect the listener to the data stream for the given instrument.
callingAlgorithmreference to calling algorithm
listenerConnectionNameName of LiveListenerInfo connection to use.
Returns
A shared pointer to the created ILiveListener implementation
Exceptions
Exception::NotFoundErrorIf the requested listener is not registered
std::runtime_errorIf 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().

◆ createUnwrapped()

ILiveListener * Mantid::API::LiveListenerFactoryImpl::createUnwrapped ( const std::string &  className) const
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.

Parameters
classNameArgument that's ignored
Returns
Never
Exceptions
Exception::NotImplementedErrorevery time!

Reimplemented from Mantid::Kernel::DynamicFactory< ILiveListener >.

Definition at line 118 of file LiveListenerFactory.cpp.

References UNUSED_ARG.

◆ operator=()

LiveListenerFactoryImpl & Mantid::API::LiveListenerFactoryImpl::operator= ( const LiveListenerFactoryImpl )
delete

Friends And Related Function Documentation

◆ Kernel::CreateUsingNew< LiveListenerFactoryImpl >

Definition at line 47 of file LiveListenerFactory.h.


The documentation for this class was generated from the following files: