Commit 45ac9263 authored by Peterson, Peter's avatar Peterson, Peter
Browse files

Adding ability to copy parameters from child algorithms

parent 823067ba
......@@ -56,6 +56,7 @@ protected:
void setAccumAlg(const std::string &alg);
void setPropManagerPropName(const std::string &propName);
void mapPropertyName(const std::string &nameInProp, const std::string &nameInPropManager);
void copyProperty(API::Algorithm_sptr alg, const std::string& name);
ITableWorkspace_sptr determineChunk();
void loadChunk();
Workspace_sptr load(const std::string &inputData,
......
......@@ -109,6 +109,27 @@ void DataProcessorAlgorithm::mapPropertyName(const std::string &nameInProp,
m_nameToPMName[nameInProp] = nameInPropManager;
}
/**
* Copy a property from an existing algorithm.
*
* @warning This only works if you algorithm is in the WorkflowAlgorithms sub-project.
*
* @param alg
* @param name
*
* @throws std::runtime_error If you ask to copy a non-existent property
*/
void DataProcessorAlgorithm::copyProperty(API::Algorithm_sptr alg, const std::string& name) {
if (! alg->existsProperty(name)) {
std::stringstream msg;
msg << "Algorithm \"" << alg->name() << "\" does not have property \"" << name << "\"";
throw std::runtime_error(msg.str());
}
auto prop = alg->getPointerToProperty(name);
declareProperty(prop->clone());
}
/**
* Get the property held by this object. If the value is the default see if it
* contained in the PropertyManager. @see Algorithm::getPropertyValue(const string &)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment