本文整理汇总了C++中IAlgorithm_sptr::setPropertiesWithSimpleString方法的典型用法代码示例。如果您正苦于以下问题:C++ IAlgorithm_sptr::setPropertiesWithSimpleString方法的具体用法?C++ IAlgorithm_sptr::setPropertiesWithSimpleString怎么用?C++ IAlgorithm_sptr::setPropertiesWithSimpleString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAlgorithm_sptr
的用法示例。
在下文中一共展示了IAlgorithm_sptr::setPropertiesWithSimpleString方法的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);
if (!algoName.empty()) {
// 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::set<std::string> ignoreProps;
ignoreProps.insert("InputWorkspace");
ignoreProps.insert("OutputWorkspace");
// ...and pass it the properties
alg->setPropertiesWithSimpleString(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" << std::endl;
return alg;
} else if (!script.empty()) {
// Run a snippet of python
IAlgorithm_sptr alg = this->createChildAlgorithm("RunPythonScript");
alg->setLogging(false);
alg->setPropertyValue("Code", script);
return alg;
} else
return IAlgorithm_sptr();
}