Mantid
|
The AlgorithmManagerImpl class is responsible for controlling algorithm instances. More...
#include <AlgorithmManager.h>
Public Member Functions | |
void | cancelAll () |
Requests cancellation of all running algorithms. More... | |
void | clear () |
Clears all managed algorithm objects that are not currently running. More... | |
IAlgorithm_sptr | create (const std::string &algName, const int &version=-1) |
Creates a managed algorithm with the option of choosing a version. More... | |
std::shared_ptr< Algorithm > | createUnmanaged (const std::string &algName, const int &version=-1) const |
Creates an unmanaged algorithm with the option of choosing a version. More... | |
IAlgorithm_sptr | getAlgorithm (AlgorithmID id) const |
Returns a shared pointer by algorithm id. More... | |
void | notifyAlgorithmStarting (AlgorithmID id) |
Called by an algorithm that is executing asynchronously This sends out the notification. More... | |
void | removeById (AlgorithmID id) |
Removes the given algorithm from the managed list. More... | |
std::vector< IAlgorithm_const_sptr > | runningInstances () const |
Returns all running (& managed) occurances of any algorithm, oldest first. More... | |
std::vector< IAlgorithm_const_sptr > | runningInstancesOf (const std::string &algorithmName) const |
Returns all running (& managed) occurances of the named algorithm, oldest first. More... | |
void | shutdown () |
std::size_t | size () const |
Public Attributes | |
Poco::NotificationCenter | notificationCenter |
Sends notifications to observers. More... | |
Private Member Functions | |
AlgorithmManagerImpl () | |
Private Constructor for singleton class. More... | |
AlgorithmManagerImpl (const AlgorithmManagerImpl &) | |
Unimplemented copy constructor. More... | |
AlgorithmManagerImpl & | operator= (const AlgorithmManagerImpl &) |
Unimplemented assignment operator. More... | |
size_t | removeFinishedAlgorithms () |
Removes any finished algorithms from the list of managed algorithms. More... | |
~AlgorithmManagerImpl () | |
Private destructor Prevents client from calling 'delete' on the pointer handed out by Instance. More... | |
Private Attributes | |
std::deque< IAlgorithm_sptr > | m_managed_algs |
The list of managed algorithms. More... | |
std::mutex | m_managedMutex |
Mutex for modifying/accessing the m_managed_algs member. More... | |
Friends | |
struct | Mantid::Kernel::CreateUsingNew< AlgorithmManagerImpl > |
The AlgorithmManagerImpl class is responsible for controlling algorithm instances.
It incorporates the algorithm factory and initializes algorithms.
Definition at line 41 of file AlgorithmManager.h.
|
private |
Private Constructor for singleton class.
Definition at line 22 of file AlgorithmManager.cpp.
References Mantid::Kernel::Logger::debug(), and Mantid::API::g_log.
|
privatedefault |
Private destructor Prevents client from calling 'delete' on the pointer handed out by Instance.
|
private |
Unimplemented copy constructor.
void Mantid::API::AlgorithmManagerImpl::cancelAll | ( | ) |
Requests cancellation of all running algorithms.
Definition at line 161 of file AlgorithmManager.cpp.
References m_managed_algs, and m_managedMutex.
void Mantid::API::AlgorithmManagerImpl::clear | ( | ) |
Clears all managed algorithm objects that are not currently running.
Definition at line 78 of file AlgorithmManager.cpp.
References m_managed_algs, and m_managedMutex.
Referenced by shutdown().
IAlgorithm_sptr Mantid::API::AlgorithmManagerImpl::create | ( | const std::string & | algName, |
const int & | version = -1 |
||
) |
Creates a managed algorithm with the option of choosing a version.
Creates and initialises an instance of an algorithm.
The algorithm gets tracked in the list of "managed" algorithms, which is shown in GUI for cancelling, etc.
algName | :: The name of the algorithm required |
version | :: The version of the algorithm required, if not defined most recent version is used -> version =-1 |
NotFoundError | Thrown if algorithm requested is not registered |
std::runtime_error | Thrown if properties string is ill-formed |
Definition at line 55 of file AlgorithmManager.cpp.
References count, Mantid::Kernel::Logger::debug(), Mantid::Kernel::Logger::error(), Mantid::API::g_log, Mantid::Kernel::SingletonHolder< T >::Instance(), m_managed_algs, m_managedMutex, and removeFinishedAlgorithms().
Algorithm_sptr Mantid::API::AlgorithmManagerImpl::createUnmanaged | ( | const std::string & | algName, |
const int & | version = -1 |
||
) | const |
Creates an unmanaged algorithm with the option of choosing a version.
Creates an instance of an algorithm, but does not own that instance.
algName | The name of the algorithm required |
version | The version of the algorithm required, if not defined most recent version is used -> version =-1 |
NotFoundError | Thrown if algorithm requested is not registered |
Definition at line 38 of file AlgorithmManager.cpp.
References Mantid::Kernel::SingletonHolder< T >::Instance().
Referenced by export_AlgorithmManager().
IAlgorithm_sptr Mantid::API::AlgorithmManagerImpl::getAlgorithm | ( | AlgorithmID | id | ) | const |
Returns a shared pointer by algorithm id.
id | :: The ID of the algorithm |
Definition at line 96 of file AlgorithmManager.cpp.
References m_managed_algs, and m_managedMutex.
Referenced by notifyAlgorithmStarting().
void Mantid::API::AlgorithmManagerImpl::notifyAlgorithmStarting | ( | AlgorithmID | id | ) |
Called by an algorithm that is executing asynchronously This sends out the notification.
id | :: ID of the algorithm being started |
Definition at line 132 of file AlgorithmManager.cpp.
References getAlgorithm(), and notificationCenter.
|
private |
Unimplemented assignment operator.
void Mantid::API::AlgorithmManagerImpl::removeById | ( | AlgorithmID | id | ) |
Removes the given algorithm from the managed list.
id | :: The ID of the algorithm |
Definition at line 111 of file AlgorithmManager.cpp.
References Mantid::Kernel::Logger::debug(), Mantid::API::g_log, m_managed_algs, and m_managedMutex.
|
private |
Removes any finished algorithms from the list of managed algorithms.
Removes all of the finished algorithms this does not lock the mutex as the locking is already assumed to be in place.
Definition at line 172 of file AlgorithmManager.cpp.
References m_managed_algs.
Referenced by create().
std::vector< IAlgorithm_const_sptr > Mantid::API::AlgorithmManagerImpl::runningInstances | ( | ) | const |
Returns all running (& managed) occurances of any algorithm, oldest first.
Definition at line 152 of file AlgorithmManager.cpp.
References m_managed_algs, and m_managedMutex.
std::vector< IAlgorithm_const_sptr > Mantid::API::AlgorithmManagerImpl::runningInstancesOf | ( | const std::string & | algorithmName | ) | const |
Returns all running (& managed) occurances of the named algorithm, oldest first.
Definition at line 141 of file AlgorithmManager.cpp.
References m_managed_algs, and m_managedMutex.
void Mantid::API::AlgorithmManagerImpl::shutdown | ( | ) |
Definition at line 188 of file AlgorithmManager.cpp.
References clear().
std::size_t Mantid::API::AlgorithmManagerImpl::size | ( | ) | const |
Definition at line 89 of file AlgorithmManager.cpp.
References m_managed_algs.
Referenced by export_AlgorithmManager().
|
friend |
Definition at line 64 of file AlgorithmManager.h.
|
private |
The list of managed algorithms.
pointers to managed algorithms [policy???]
Definition at line 81 of file AlgorithmManager.h.
Referenced by cancelAll(), clear(), create(), getAlgorithm(), removeById(), removeFinishedAlgorithms(), runningInstances(), runningInstancesOf(), and size().
|
mutableprivate |
Mutex for modifying/accessing the m_managed_algs member.
Definition at line 83 of file AlgorithmManager.h.
Referenced by cancelAll(), clear(), create(), getAlgorithm(), removeById(), runningInstances(), and runningInstancesOf().
Poco::NotificationCenter Mantid::API::AlgorithmManagerImpl::notificationCenter |
Sends notifications to observers.
Observers can subscribe to notificationCenter using Poco::NotificationCenter::addObserver(...)
Definition at line 59 of file AlgorithmManager.h.
Referenced by notifyAlgorithmStarting().