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 "FWCore/PluginManager/interface/PluginCapabilities.h"
#include "ClassUtils.h"
#include <typeinfo>
#include <cxxabi.h>
#include "FWCore/Utilities/interface/ObjectWithDict.h"
#include "FWCore/Utilities/interface/BaseWithDict.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 69 of file ClassUtils.cc.

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

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

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

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

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