CMS 3D CMS Logo

Functions
fireworks::expression Namespace Reference

Functions

long indexFromNewFormatToOldFormat (const std::string &iNewFormat, long iNewFormatIndex, const std::string &iOldFormat)
 
std::string oldToNewFormat (const std::string &iExpression)
 

Function Documentation

◆ indexFromNewFormatToOldFormat()

long fireworks::expression::indexFromNewFormatToOldFormat ( const std::string &  iNewFormat,
long  iNewFormatIndex,
const std::string &  iOldFormat 
)

Definition at line 33 of file expressionFormatHelpers.cc.

References cms::cuda::assert().

Referenced by FWModelExpressionSelector::select(), FWExpressionEvaluator::setExpression(), and FWModelFilter::setExpression().

35  {
36  if (iNewFormat.substr(0, iNewFormatIndex) == iOldFormat.substr(0, iNewFormatIndex)) {
37  return iNewFormatIndex;
38  }
39  assert(iNewFormat.size() < iOldFormat.size());
40  std::string::const_iterator itNew = iNewFormat.begin(), itOld = iOldFormat.begin(), itNewEnd = iNewFormat.end();
41  for (; itNew != itNewEnd && itNew - iNewFormat.begin() < iNewFormatIndex; ++itNew, ++itOld) {
42  while (*itNew != *itOld) {
43  assert(itOld != iOldFormat.end());
44  ++itOld;
45  }
46  }
47  return itOld - iOldFormat.begin();
48  }
assert(be >=bs)

◆ oldToNewFormat()

std::string fireworks::expression::oldToNewFormat ( const std::string &  iExpression)

Definition at line 25 of file expressionFormatHelpers.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, and taus_updatedMVAIds_cff::variable.

Referenced by FWItemValueGetter::addEntry(), FWModelExpressionSelector::select(), FWExpressionEvaluator::setExpression(), and FWModelFilter::setExpression().

25  {
26  //Backwards compatibility with old format: If find a $. or a () just remove them
27  const std::string variable;
28  static boost::regex const reVarName("(\\$\\.)|(\\(\\))");
29 
30  return boost::regex_replace(iExpression, reVarName, variable);
31  }