test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
ClassUtils.cc File Reference
#include "CondCore/ORA/interface/Exception.h"
#include "CondCore/ORA/interface/Reference.h"
#include "CondCore/ORA/interface/NamedRef.h"
#include "ClassUtils.h"
#include <typeinfo>
#include <cxxabi.h>
#include "FWCore/Utilities/interface/TypeWithDict.h"
#include "FWCore/Utilities/interface/ObjectWithDict.h"
#include "FWCore/Utilities/interface/BaseWithDict.h"
#include "FWCore/Utilities/interface/EDMException.h"
#include "TROOT.h"
#include "TDictAttributeMap.h"

Go to the source code of this file.

Functions

static bool compareWithSuffixes (std::string const &name, std::string const &other)
 
static void replaceString (std::string &name, std::string const &from, std::string const &to)
 

Function Documentation

static bool compareWithSuffixes ( std::string const &  name,
std::string const &  other 
)
static

Definition at line 72 of file ClassUtils.cc.

References EnergyCorrector::c, i, j, gen::n, and lumiQueryAPI::q.

Referenced by ora::ClassUtils::checkMappedType().

72  {
73  size_t pos = name.find('<');
74  if(pos == std::string::npos) {
75  // Not a template instance
76  return false;
77  }
78  size_t nameSize = name.size();
79  if(other.size() >= nameSize) {
80  // Can't be a case with ull qualifiers no name.
81  return false;
82  }
83  if(name.substr(0, pos) != other.substr(0, pos)) {
84  return false;
85  }
86  int nesting = 0;
87  size_t j = pos;
88  for(size_t i = pos; i < nameSize; ++i) {
89  char c = name[i];
90  if (c == '<') ++nesting;
91  if(c != other[j]) {
92  if(c != 'u' && c != 'l') return false;
93  if(nesting == 0) return false;
94  if(!isdigit(name[i-1])) return false;
95  for(size_t n = i-2; n >= pos; --n) {
96  char q = name[n];
97  if(q == '<' || q == ',') break;
98  if(!isdigit(q)) return false;
99  }
100  for(size_t n = i+1; n < nameSize; ++n) {
101  char q = name[n];
102  if(q == '>' || q == ',') break;
103  if(q != 'l') return false;
104  ++i;
105  }
106  continue;
107  }
108  if (c == '>') --nesting;
109  ++j;
110  }
111  return true;
112 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
static void replaceString ( std::string &  name,
std::string const &  from,
std::string const &  to 
)
static

Definition at line 61 of file ClassUtils.cc.

Referenced by ora::ClassUtils::checkMappedType(), and L1GtVhdlTemplateFile::findAndReplaceString().

61  {
62  // from must not be a substring of to.
63  std::string::size_type length = from.size();
64  std::string::size_type pos = 0;
65  while((pos = name.find(from, pos)) != std::string::npos) {
66  name.replace(pos, length, to);
67  }
68 }
uint16_t size_type