11#include <Poco/Net/SocketAddress.h>
18Kernel::Logger
g_log(
"LiveListenerFactory");
39 const std::string &listenerConnectionName)
const {
43 auto info = inst.liveListenerInfo(listenerConnectionName);
46 return create(info, connect, callingAlgorithm);
53 return create(info, connect, callingAlgorithm);
76 if (callingAlgorithm) {
77 listener->setAlgorithm(*callingAlgorithm);
82 Poco::Net::SocketAddress address;
86 address = Poco::Net::SocketAddress(info.
address());
89 if (!listener->connect(address)) {
90 throw Poco::Exception(
"Connection attempt failed.");
97 catch (Poco::Exception &pocoEx) {
99 ss <<
"Unable to connect listener [" << info.
listener() <<
"] to [" << info.
address() <<
"]: " << pocoEx.what();
101 throw std::runtime_error(ss.str());
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
IAlgorithm is the interface implemented by the Algorithm base class.
ILiveListener is the interface implemented by classes which connect directly to instrument data acqui...
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 connect...
ILiveListener * createUnwrapped(const std::string &className) const override
Override the DynamicFactory::createUnwrapped() method.
virtual std::shared_ptr< Base > create(const std::string &className) const
Creates a new instance of the class with the given name.
Exception for when an item is not found in a collection.
Marks code as not implemented yet.
A class that holds information about a LiveListener connection.
const std::string & address() const
Returns the address string of this LiveListener connection.
const std::string & listener() const
Returns the classname of the specific LiveListener to use.
void debug(const std::string &msg)
Logs at debug level.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< ILiveListener > ILiveListener_sptr
Shared pointer to an ILiveListener.
Kernel::Logger g_log("ExperimentInfo")
static logger object