|
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. | |
| void | clear () |
| Clears all managed algorithm objects that are not currently running. | |
| IAlgorithm_sptr | create (const std::string &algName, const int &version=-1) |
| Creates a managed algorithm with the option of choosing a version. | |
| 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. | |
| IAlgorithm_sptr | getAlgorithm (AlgorithmID id) const |
| Returns a shared pointer by algorithm id. | |
| void | notifyAlgorithmStarting (AlgorithmID id) |
| Called by an algorithm that is executing asynchronously This sends out the notification. | |
| void | removeById (AlgorithmID id) |
| Removes the given algorithm from the managed list. | |
| std::vector< IAlgorithm_const_sptr > | runningInstances () const |
| Returns all running (& managed) occurances of any algorithm, oldest first. | |
| std::vector< IAlgorithm_const_sptr > | runningInstancesOf (const std::string &algorithmName) const |
| Returns all running (& managed) occurances of the named algorithm, oldest first. | |
| void | shutdown () |
| std::size_t | size () const |
Public Attributes | |
| Poco::NotificationCenter | notificationCenter |
| Sends notifications to observers. | |
Private Member Functions | |
| AlgorithmManagerImpl () | |
| Private Constructor for singleton class. | |
| AlgorithmManagerImpl (const AlgorithmManagerImpl &) | |
| Unimplemented copy constructor. | |
| AlgorithmManagerImpl & | operator= (const AlgorithmManagerImpl &) |
| Unimplemented assignment operator. | |
| size_t | removeFinishedAlgorithms () |
| Removes any finished algorithms from the list of managed algorithms. | |
| ~AlgorithmManagerImpl () | |
| Private destructor Prevents client from calling 'delete' on the pointer handed out by Instance. | |
Private Attributes | |
| std::deque< IAlgorithm_sptr > | m_managed_algs |
| The list of managed algorithms. | |
| std::recursive_mutex | m_managedMutex |
| Mutex for modifying/accessing the m_managed_algs member. | |
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 23 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.
Referenced by shutdown().
| void Mantid::API::AlgorithmManagerImpl::clear | ( | ) |
Clears all managed algorithm objects that are not currently running.
Definition at line 79 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 56 of file AlgorithmManager.cpp.
References count, Mantid::Kernel::Logger::debug(), Mantid::Kernel::Logger::error(), Mantid::API::g_log, 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 39 of file AlgorithmManager.cpp.
| 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 97 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 112 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.
Definition at line 170 of file AlgorithmManager.cpp.
References m_managed_algs, and m_managedMutex.
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.
Referenced by shutdown().
| 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 186 of file AlgorithmManager.cpp.
References cancelAll(), clear(), runningInstances(), and size().
| std::size_t Mantid::API::AlgorithmManagerImpl::size | ( | ) | const |
Definition at line 90 of file AlgorithmManager.cpp.
References m_managed_algs.
Referenced by export_AlgorithmManager(), and shutdown().
|
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(), removeFinishedAlgorithms(), 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().