本文整理汇总了C++中IAlgorithm_sptr::setPropertiesWithString方法的典型用法代码示例。如果您正苦于以下问题:C++ IAlgorithm_sptr::setPropertiesWithString方法的具体用法?C++ IAlgorithm_sptr::setPropertiesWithString怎么用?C++ IAlgorithm_sptr::setPropertiesWithString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAlgorithm_sptr
的用法示例。
在下文中一共展示了IAlgorithm_sptr::setPropertiesWithString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeAlgorithm
/** Using the [Post]ProcessingAlgorithm and [Post]ProcessingProperties
*properties,
* create and initialize an algorithm for processing.
*
* @param postProcessing :: true to create the PostProcessingAlgorithm.
* false to create the ProcessingAlgorithm
* @return shared pointer to the algorithm, ready for execution.
* Returns a NULL pointer if no algorithm was chosen.
*/
IAlgorithm_sptr LiveDataAlgorithm::makeAlgorithm(bool postProcessing) {
std::string prefix;
if (postProcessing)
prefix = "Post";
// Get the name of the algorithm to run
std::string algoName = this->getPropertyValue(prefix + "ProcessingAlgorithm");
algoName = Strings::strip(algoName);
// Get the script to run. Ignored if algo is specified
std::string script = this->getPropertyValue(prefix + "ProcessingScript");
script = Strings::strip(script);
std::string scriptfile =
this->getPropertyValue(prefix + "ProcessingScriptFilename");
if (!algoName.empty()) {
g_log.information() << "Creating algorithm from name \'" << algoName
<< "\'\n";
// Properties to pass to algo
std::string props = this->getPropertyValue(prefix + "ProcessingProperties");
// Create the UNMANAGED algorithm
IAlgorithm_sptr alg = this->createChildAlgorithm(algoName);
// Skip some of the properties when setting
std::unordered_set<std::string> ignoreProps;
ignoreProps.insert("InputWorkspace");
ignoreProps.insert("OutputWorkspace");
// ...and pass it the properties
alg->setPropertiesWithString(props, ignoreProps);
// Warn if someone put both values.
if (!script.empty())
g_log.warning() << "Running algorithm " << algoName
<< " and ignoring the script code in "
<< prefix + "ProcessingScript\n";
return alg;
} else if (!script.empty() || !scriptfile.empty()) {
// Run a snippet of python
IAlgorithm_sptr alg = this->createChildAlgorithm("RunPythonScript");
alg->setLogging(false);
if (scriptfile.empty()) {
g_log.information("Creating python algorithm from string");
alg->setPropertyValue("Code", script);
} else {
g_log.information() << "Creating python algorithm from file \'"
<< scriptfile << "\'\n";
alg->setPropertyValue("Filename", scriptfile);
}
g_log.information(" stack traces will be off by 5"
" lines because of boiler-plate");
return alg;
} else {
return IAlgorithm_sptr();
}
}