Mantid
|
Provides a layer class for boost::python to allow C++ virtual functions to be overridden in a Python object that is derived an Algorithm. More...
#include <AlgorithmAdapter.h>
Public Member Functions | |
AlgorithmAdapter ()=delete | |
Disable default constructor - The PyObject must be supplied to construct the object. More... | |
AlgorithmAdapter (const AlgorithmAdapter &)=delete | |
Disable copy operator. More... | |
AlgorithmAdapter (PyObject *self) | |
A constructor that looks like a Python init method. More... | |
AlgorithmAdapter & | operator= (const AlgorithmAdapter &)=delete |
Disable assignment operator. More... | |
void | setWikiSummary (const std::string &summary) |
Set the summary text. More... | |
Algorithm virtual methods | |
const std::string | name () const override |
Returns the name of the algorithm. More... | |
int | version () const override |
Returns a version of the algorithm. More... | |
const std::string | summary () const override |
Returns the summary for the algorithm. More... | |
const std::string | category () const override |
Returns a category of the algorithm. More... | |
const std::vector< std::string > | seeAlso () const override |
Returns seeAlso related algorithms. More... | |
const std::string | alias () const override |
Allow the method returning the algorithm aliases to be overridden. More... | |
const std::string | aliasDeprecated () const override |
Returns optional documentation URL of the algorithm. More... | |
const std::string | helpURL () const override |
Optional documentation URL of the algorithm, empty string if not overridden. More... | |
bool | isRunning () const override |
Allow the isRunning method to be overridden. More... | |
void | cancel () override |
Allow the cancel method to be overridden. More... | |
bool | checkGroups () override |
A return of false will allow processing workspace groups as a whole. More... | |
std::map< std::string, std::string > | validateInputs () override |
Returns the validateInputs result of the algorithm. More... | |
Private Types | |
using | SuperClass = BaseAlgorithm |
Property declarations | |
The first function matches the base-classes signature so a different name is used consistently to avoid accidentally calling the wrong function internally From Python they will still be called declareProperty | |
PyObject * | m_self |
The Python portion of the object. More... | |
PyObject * | m_isRunningObj |
A pointer to an overridden isRunning method. More... | |
std::string | m_wikiSummary |
Here for deprecated setWikiSummary method. More... | |
static void | declarePyAlgProperty (boost::python::object &self, Kernel::Property *prop, const std::string &doc="") |
Declare a preconstructed property. More... | |
static void | declarePyAlgProperty (boost::python::object &self, const std::string &name, const boost::python::object &defaultValue, const boost::python::object &validator=boost::python::object(), const std::string &doc="", const int direction=Kernel::Direction::Input) |
Declare a property using the type of the defaultValue with a validator and doc string. More... | |
static void | declarePyAlgProperty (boost::python::object &self, const std::string &name, const boost::python::object &defaultValue, const std::string &doc, const int direction=Kernel::Direction::Input) |
Declare a property with a documentation string. More... | |
static void | declarePyAlgProperty (boost::python::object &self, const std::string &name, const boost::python::object &defaultValue, const int direction) |
Declare a property using the type of the defaultValue. More... | |
PyObject * | getSelf () const |
Returns the PyObject that owns this wrapper, i.e. More... | |
void | init () override |
Private init for this algorithm. More... | |
void | exec () override |
Private exec for this algorithm. More... | |
Provides a layer class for boost::python to allow C++ virtual functions to be overridden in a Python object that is derived an Algorithm.
The templated-base class provides a mechanism to reuse the same adapter class for other classes that inherit from a different Algorithm sub class
Definition at line 27 of file AlgorithmAdapter.h.
|
private |
Definition at line 28 of file AlgorithmAdapter.h.
Mantid::PythonInterface::AlgorithmAdapter< BaseAlgorithm >::AlgorithmAdapter | ( | PyObject * | self | ) |
A constructor that looks like a Python init method.
Construct the "wrapper" and stores the reference to the PyObject.
self | A reference to the calling Python object |
Definition at line 33 of file AlgorithmAdapter.cpp.
References Mantid::PythonInterface::AlgorithmAdapter< BaseAlgorithm >::m_isRunningObj, and Mantid::PythonInterface::typeHasAttribute().
|
delete |
Disable default constructor - The PyObject must be supplied to construct the object.
|
delete |
Disable copy operator.
|
override |
Allow the method returning the algorithm aliases to be overridden.
Returns the aliases of the algorithm.
If not overridden returns the base algorithm implementation
Definition at line 112 of file AlgorithmAdapter.cpp.
|
override |
Returns optional documentation URL of the algorithm.
Returns the expiration date (in ISO8601 format) of algorithm aliases.
Allow the method returning the expiration date (in ISO8601 format) for the algorithm aliases to be overridden
If not overridden, returns the base algorithm implementation
Definition at line 124 of file AlgorithmAdapter.cpp.
|
override |
Allow the cancel method to be overridden.
Definition at line 176 of file AlgorithmAdapter.cpp.
|
override |
Returns a category of the algorithm.
Returns the category of the algorithm.
If not overridden it return defaultCategory()
Definition at line 78 of file AlgorithmAdapter.cpp.
|
override |
A return of false will allow processing workspace groups as a whole.
Returns checkGroups.
If false, workspace groups will be treated as a whole If true, the algorithm will act on each component of the workspace group individually
Definition at line 66 of file AlgorithmAdapter.cpp.
|
static |
Declare a property using the type of the defaultValue with a validator and doc string.
Declare a property using the type of the defaultValue, a documentation string and validator.
self | A reference to the calling Python object |
name | :: The name of the new property |
defaultValue | :: A default value for the property. The type is mapped to a C++ type |
validator | :: A validator object |
doc | :: The documentation string |
direction | :: The direction of the property |
Definition at line 264 of file AlgorithmAdapter.cpp.
References Mantid::PythonInterface::Registry::PropertyWithValueFactory::create().
|
static |
Declare a property using the type of the defaultValue.
self | A reference to the calling Python object |
name | :: The name of the new property |
defaultValue | :: A default value for the property. The type is mapped to a C++ type |
direction | :: The direction of the property |
Definition at line 303 of file AlgorithmAdapter.cpp.
|
static |
Declare a property with a documentation string.
Declare a property using the type of the defaultValue and a documentation string.
self | A reference to the calling Python object |
name | :: The name of the new property |
defaultValue | :: A default value for the property. The type is mapped to a C++ type |
doc | :: The documentation string |
direction | :: The direction of the property |
Definition at line 285 of file AlgorithmAdapter.cpp.
References Mantid::PythonInterface::Registry::PropertyWithValueFactory::create().
|
static |
Declare a preconstructed property.
Declare a specialized property
self | A reference to the calling Python object |
prop | :: A pointer to a property |
doc | :: An optional doc string |
Definition at line 242 of file AlgorithmAdapter.cpp.
References Mantid::Kernel::Property::clone().
|
overrideprivate |
Private exec for this algorithm.
Expected to be overridden in the subclass by a function named PyExec
Definition at line 325 of file AlgorithmAdapter.cpp.
|
inlineprotected |
Returns the PyObject that owns this wrapper, i.e.
self
Definition at line 109 of file AlgorithmAdapter.h.
References Mantid::PythonInterface::AlgorithmAdapter< BaseAlgorithm >::m_self.
|
override |
Optional documentation URL of the algorithm, empty string if not overridden.
Definition at line 147 of file AlgorithmAdapter.cpp.
|
overrideprivate |
Private init for this algorithm.
Expected to be overridden in the subclass by a function named PyInit
Definition at line 317 of file AlgorithmAdapter.cpp.
|
override |
Allow the isRunning method to be overridden.
Definition at line 158 of file AlgorithmAdapter.cpp.
References GNU_DIAG_OFF, and GNU_DIAG_ON.
|
override |
Returns the name of the algorithm.
Returns the name of the algorithm
This cannot be overridden in Python.
Definition at line 45 of file AlgorithmAdapter.cpp.
|
delete |
Disable assignment operator.
|
override |
Returns seeAlso related algorithms.
If not overridden it returns an empty vector of strings
Definition at line 98 of file AlgorithmAdapter.cpp.
void Mantid::PythonInterface::AlgorithmAdapter< BaseAlgorithm >::setWikiSummary | ( | const std::string & | summary | ) |
Set the summary text.
summary | Wiki text |
Definition at line 221 of file AlgorithmAdapter.cpp.
|
override |
Returns the summary for the algorithm.
Returns the summary of the algorithm.
If not overridden it returns defaultSummary
Definition at line 136 of file AlgorithmAdapter.cpp.
|
override |
Returns the validateInputs result of the algorithm.
Perform validation of ALL the input properties of the algorithm.
This is to be overridden by specific algorithms. It will be called in dialogs after parsing all inputs and setting the properties, but BEFORE executing.
Definition at line 187 of file AlgorithmAdapter.cpp.
References value.
|
override |
Returns a version of the algorithm.
Returns the version of the algorithm.
If not overridden it returns 1
Definition at line 53 of file AlgorithmAdapter.cpp.
|
private |
A pointer to an overridden isRunning method.
Definition at line 123 of file AlgorithmAdapter.h.
Referenced by Mantid::PythonInterface::AlgorithmAdapter< BaseAlgorithm >::AlgorithmAdapter().
|
private |
The Python portion of the object.
Definition at line 121 of file AlgorithmAdapter.h.
Referenced by Mantid::PythonInterface::AlgorithmAdapter< BaseAlgorithm >::getSelf().
|
private |
Here for deprecated setWikiSummary method.
Definition at line 126 of file AlgorithmAdapter.h.