test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

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

Definition at line 34 of file expressionFormatHelpers.cc.

References assert().

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

37  {
38  if(iNewFormat.substr(0,iNewFormatIndex) ==
39  iOldFormat.substr(0,iNewFormatIndex)) {
40  return iNewFormatIndex;
41  }
42  assert(iNewFormat.size()< iOldFormat.size());
43  std::string::const_iterator itNew = iNewFormat.begin(), itOld = iOldFormat.begin(),
44  itNewEnd = iNewFormat.end();
45  for(;
46  itNew != itNewEnd && itNew-iNewFormat.begin() < iNewFormatIndex;
47  ++itNew, ++itOld) {
48  while(*itNew != *itOld) {
49  assert(itOld != iOldFormat.end());
50  ++itOld;
51  }
52  }
53  return itOld - iOldFormat.begin();
54  }
assert(m_qm.get())
std::string fireworks::expression::oldToNewFormat ( const std::string &  iExpression)

Definition at line 26 of file expressionFormatHelpers.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

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

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