Mantid
Loading...
Searching...
No Matches
IAlgorithm.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
12#include "MantidAPI/DllConfig.h"
16
17namespace Poco {
18class AbstractObserver;
19template <class T> class ActiveResult;
20} // namespace Poco
21
22namespace Mantid {
23namespace API {
24
29using AlgorithmID = void *;
30
35
46class MANTID_API_DLL IAlgorithm : virtual public Kernel::IPropertyManager {
47public:
50 virtual const std::string name() const = 0;
51
54 virtual int version() const = 0;
55
58 virtual const std::string summary() const = 0;
59
61 virtual const std::string category() const = 0;
62
64 virtual const std::vector<std::string> categories() const = 0;
65
67 virtual const std::string categorySeparator() const = 0;
68
70 virtual const std::vector<std::string> seeAlso() const = 0;
71
73 virtual const std::string aliasDeprecated() const = 0;
74
76 virtual const std::string alias() const = 0;
77
80 virtual const std::string helpURL() const = 0;
81
86 virtual const std::string workspaceMethodName() const = 0;
89 virtual const std::vector<std::string> workspaceMethodOn() const = 0;
92 virtual const std::string workspaceMethodInputProperty() const = 0;
94
97 virtual AlgorithmID getAlgorithmID() const = 0;
98
104 virtual void initialize() = 0;
105
108 virtual std::map<std::string, std::string> validateInputs() = 0;
109
112 virtual bool execute() = 0;
113
116
118 virtual void executeAsChildAlg() = 0;
119
121 virtual ExecutionState executionState() const = 0;
122
124 virtual ResultState resultState() const = 0;
125
127 virtual bool isInitialized() const = 0;
129 virtual bool isExecuted() const = 0;
130
134 virtual void cancel() = 0;
135
137 virtual bool isRunning() const = 0;
138
140 virtual bool isReadyForGarbageCollection() const = 0;
141
143 virtual bool isChild() const = 0;
144
146 virtual bool getAlwaysStoreInADS() const = 0;
147
152 virtual void setChild(const bool isChild) = 0;
153
155 virtual void enableHistoryRecordingForChild(const bool on) = 0;
157 virtual void enableHistoryRecordingForProcessGroups(const bool on) = 0;
158
160 virtual void setAlwaysStoreInADS(const bool doStore) = 0;
161
163 virtual void setRethrows(const bool rethrow) = 0;
164
166 virtual void addObserver(const Poco::AbstractObserver &observer) const = 0;
167
169 virtual void removeObserver(const Poco::AbstractObserver &observer) const = 0;
170
172 virtual void setLogging(const bool value) = 0;
174 virtual bool isLogging() const = 0;
176 virtual void setLoggingOffset(const int value) = 0;
178 virtual int getLoggingOffset() const = 0;
180 virtual void setAlgStartupLogging(const bool enabled) = 0;
182 virtual bool getAlgStartupLogging() const = 0;
184 virtual void setChildStartProgress(const double startProgress) const = 0;
186 virtual void setChildEndProgress(const double endProgress) const = 0;
188 virtual std::string toString() const = 0;
190 virtual ::Json::Value toJson() const = 0;
191
192private:
193 using Kernel::IPropertyManager::asJson;
194};
195
196} // namespace API
197} // namespace Mantid
198
199// Instantiated and exported by API/src/PropertyWithValue.cpp
200MANTID_API_EXTERN_TEMPLATE(Mantid::Kernel::PropertyWithValue<std::shared_ptr<Mantid::API::IAlgorithm>>);
double value
The value of the point.
Definition FitMW.cpp:51
MANTID_API_EXTERN_TEMPLATE(Mantid::Kernel::PropertyWithValue< std::shared_ptr< Mantid::API::IAlgorithm > >)
IAlgorithm is the interface implemented by the Algorithm base class.
Definition IAlgorithm.h:46
virtual const std::string workspaceMethodInputProperty() const =0
Returns the name of the input workspace property used by the calling object.
virtual std::string toString() const =0
Serialize an algorithm.
virtual ::Json::Value toJson() const =0
Serialize an algorithm as Json.
virtual Poco::ActiveResult< bool > executeAsync()=0
Asynchronous execution of the algorithm.
virtual bool isExecuted() const =0
Check whether the algorithm has been executed sucessfully.
virtual bool isInitialized() const =0
Check whether the algorithm is initialized properly.
virtual const std::string alias() const =0
function to return any aliases of the algorithm.
virtual void removeObserver(const Poco::AbstractObserver &observer) const =0
Remove an observer.
virtual bool isChild() const =0
To query whether algorithm is a child. Default to false.
virtual int version() const =0
function to return a version of the algorithm, must be overridden in all algorithms
virtual const std::string aliasDeprecated() const =0
Expiration date (in ISO8601 format) for the algorithm aliases. Empty if no expiration date.
virtual const std::string categorySeparator() const =0
Function to return the separator token for the category string.
virtual const std::string helpURL() const =0
function to return an optional URL for documentation.
virtual void setChildStartProgress(const double startProgress) const =0
setting the child start progress
virtual void enableHistoryRecordingForProcessGroups(const bool on)=0
If true parent history will be recorded for algorithms that handle group outputs directly.
virtual const std::vector< std::string > categories() const =0
Function to return all of the categories that contain this algorithm.
virtual bool isLogging() const =0
returns the status of logging, True = enabled
virtual ExecutionState executionState() const =0
Gets the current execution state.
virtual const std::vector< std::string > seeAlso() const =0
Function to return all of the seeAlso algorithms related to this algorithm.
virtual bool isRunning() const =0
True if the algorithm is running.
virtual const std::string category() const =0
function to return a category of the algorithm.
virtual bool isReadyForGarbageCollection() const =0
True if the algorithm is ready for garbage collection.
virtual void setChild(const bool isChild)=0
To set whether algorithm is a child.
virtual const std::string workspaceMethodName() const =0
virtual void executeAsChildAlg()=0
Execute as a Child Algorithm, with try/catch.
virtual const std::vector< std::string > workspaceMethodOn() const =0
Returns a set of class names that will have the method attached.
virtual bool getAlgStartupLogging() const =0
get the state of Logging of start and end messages
virtual const std::string summary() const =0
function returns a summary message that will be displayed in the default GUI, and in the help.
virtual void enableHistoryRecordingForChild(const bool on)=0
If true history will be recorded for a child.
virtual bool getAlwaysStoreInADS() const =0
To query whether the output is stored in the analysis data service.
virtual void setLogging(const bool value)=0
Logging can be disabled by passing a value of false.
virtual void cancel()=0
Raises the cancel flag.
virtual void setLoggingOffset(const int value)=0
gets the logging priority offset
virtual void setAlwaysStoreInADS(const bool doStore)=0
Set whether we always store the output in the analysis data service.
virtual void setRethrows(const bool rethrow)=0
To query whether an algorithm should rethrow exceptions when executing.
virtual void setAlgStartupLogging(const bool enabled)=0
disable Logging of start and end messages
virtual const std::string name() const =0
function to return a name of the algorithm, must be overridden in all algorithms
virtual bool execute()=0
System execution.
virtual void setChildEndProgress(const double endProgress) const =0
setting the child end progress
virtual void addObserver(const Poco::AbstractObserver &observer) const =0
Add an observer for a notification.
virtual int getLoggingOffset() const =0
returns the logging priority offset
virtual std::map< std::string, std::string > validateInputs()=0
Method checking errors on ALL the inputs, before execution.
virtual AlgorithmID getAlgorithmID() const =0
Algorithm ID.
virtual ResultState resultState() const =0
Gets the currnet result State.
virtual void initialize()=0
Initialization method invoked by the framework.
Interface to PropertyManager.
The concrete, templated class for properties.
ResultState
The validity of the results of the algorithm object.
Definition IAlgorithm.h:34
ExecutionState
The current state of the algorithm object.
Definition IAlgorithm.h:32
void * AlgorithmID
As we have multiple interfaces to the same logical algorithm we need a way of uniquely identifying ma...
Definition IAlgorithm.h:29
Helper class which provides the Collimation Length for SANS instruments.