本文整理汇总了C++中Expression::bracketsRemoved方法的典型用法代码示例。如果您正苦于以下问题:C++ Expression::bracketsRemoved方法的具体用法?C++ Expression::bracketsRemoved怎么用?C++ Expression::bracketsRemoved使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Expression
的用法示例。
在下文中一共展示了Expression::bracketsRemoved方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createInitialized
/**Creates an instance of a function
* @param input :: An input string which defines the function and initial values for the parameters.
* Parameters of different functions are separated by ';'. Parameters of the same function
* are separated by ','. parameterName=value pairs are used to set a parameter value. For each function
* "name" parameter must be set to a function name. E.g.
* input = "name=LinearBackground,A0=0,A1=1; name = Gaussian, PeakCentre=10.,Sigma=1"
* @return A pointer to the created function
*/
IFitFunction* FunctionFactoryImpl::createInitialized(const std::string& input) const
{
//std::vector<std::string> ops;
//ops.push_back(";");
//ops.push_back(",");
//ops.push_back("=");
//ops.push_back("== < > <= >=");
Expression expr;
try
{
expr.parse(input);
}
catch(...)
{
inputError(input);
}
const Expression& e = expr.bracketsRemoved();
if (e.name() == ";")
{
IFitFunction* fun = createComposite(e);
if (!fun) inputError();
return fun;
}
return createSimple(e);
}
示例2: createSimple
/**Creates an instance of a function
* @param input :: An input string which defines the function and initial values
* for the parameters.
* Parameters of different functions are separated by ';'. Parameters of the
* same function
* are separated by ','. parameterName=value pairs are used to set a parameter
* value. For each function
* "name" parameter must be set to a function name. E.g.
* input = "name=LinearBackground,A0=0,A1=1; name = Gaussian,
* PeakCentre=10.,Sigma=1"
* @return A pointer to the created function
*/
IFunction_sptr
FunctionFactoryImpl::createInitialized(const std::string &input) const {
Expression expr;
try {
expr.parse(input);
} catch (...) {
inputError(input);
}
const Expression &e = expr.bracketsRemoved();
std::map<std::string, std::string> parentAttributes;
if (e.name() == ";") {
IFunction_sptr fun = createComposite(e, parentAttributes);
if (!fun)
inputError();
return fun;
}
return createSimple(e, parentAttributes);
}