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.

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  }

References cms::cuda::assert().

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

◆ oldToNewFormat()

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

Definition at line 25 of file expressionFormatHelpers.cc.

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  }

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

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

cms::cuda::assert
assert(be >=bs)
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
taus_updatedMVAIds_cff.variable
variable
Definition: taus_updatedMVAIds_cff.py:33