CMS 3D CMS Logo

Functions
edm::friendlyname Namespace Reference

Functions

static std::string const emptyString ("")
 
std::string friendlyName (std::string const &iFullName)
 
std::string handleNamespaces (std::string const &iIn)
 
std::string handleTemplateArguments (std::string const &)
 
static std::regex const reAIKR (", *edm::helper::AssociationIdenticalKeyReference")
 
static std::regex const reAllSpaces (" +")
 
static std::regex const reArray ("\\[\\]")
 
static std::regex const reBeginSpace ("^ +")
 
static std::regex const reclangabi ("std::__1::")
 
static std::regex const reColons ("::")
 
static std::regex const reComma (",")
 
static std::regex const reCXX11 ("std::__cxx11::")
 
static std::regex const reEndSpace (" +$")
 
static std::regex const reLong ("long ")
 
static std::regex const reLongLong ("Long64_t")
 
std::string removeAllSpaces (std::string const &iIn)
 
std::string removeExtraSpaces (std::string const &iIn)
 
static std::regex const reOneToMany ("edm::AssociationMap< *edm::OneToMany<(.*?),(.*?), *u[a-z]*> >")
 
static std::regex const reOneToManyWithQuality ("edm::AssociationMap<edm::OneToManyWithQuality<(.*?), *(.*?), *(.*?), *u[a-z]*> >")
 
static std::regex const reOneToOne ("edm::AssociationMap< *edm::OneToOne<(.*?),(.*?), *u[a-z]*> >")
 
static std::regex const reOneToValue ("edm::AssociationMap< *edm::OneToValue<(.*?),(.*?), *u[a-z]*> >")
 
static std::regex const reOwnVector ("edm::OwnVector<(.*), *edm::ClonePolicy<\\1 *> >")
 
static std::regex const rePointer ("\\*")
 
static std::regex const reSharedPtr ("std::shared_ptr")
 
static std::regex const reSorted ("edm::SortedCollection<(.*), *edm::StrictWeakOrdering<\\1 *> >")
 
static std::regex const reString ("std::basic_string<char>")
 
static std::regex const reString2 ("std::string")
 
static std::regex const reString3 ("std::basic_string<char,std::char_traits<char> >")
 
static std::regex const reTemplateArgs ("[^<]*<(.*)>$")
 
static std::regex const reTemplateClass ("([^<>,]+<[^<>]*>)")
 
static std::regex const reToRangeMap ("edm::RangeMap< *(.*), *(.*), *edm::ClonePolicy<([^>]*)> >")
 
static std::regex const reToRefs1 ("edm::RefVector< *(.*)< *(.*) *>, *\\2 *, *edm::refhelper::FindUsingAdvance< *\\1< *\\2 *> *, *\\2 *> *>")
 
static std::regex const reToRefs2 ("edm::RefVector< *(.*) *, *(.*) *, *edm::refhelper::FindUsingAdvance< *\\1, *\\2 *> *>")
 
static std::regex const reToRefsAssoc ("edm::RefVector< *Association(.*) *, *edm::helper(.*), *Association(.*)::Find>")
 
static std::regex const reToVector ("edm::AssociationVector<(.*), *(.*), *edm::Ref.*,.*>")
 
static std::regex const reULongLong ("ULong64_t")
 
static std::regex const reUniquePtr ("std::unique_ptr")
 
static std::regex const reUnsigned ("unsigned ")
 
static std::regex const reVector ("std::vector")
 
static std::regex const reWrapper ("edm::Wrapper<(.*)>")
 
std::string standardRenames (std::string const &iIn)
 
std::string subFriendlyName (std::string const &iFullName)
 

Function Documentation

static std::string const edm::friendlyname::emptyString ( ""  )
static
std::string edm::friendlyname::friendlyName ( std::string const &  iFullName)

Definition at line 158 of file FriendlyName.cc.

References handleNamespaces(), standardRenames(), and subFriendlyName().

Referenced by edm::EventContentAnalyzer::analyze(), edm::MixingModule::beginJob(), gen::FortranInstance::enter(), edm::CFWriter::fctTest(), edm::TypeID::friendlyClassName(), edm::TypeWithDict::friendlyClassName(), gen::FortranInstance::leave(), main(), edm::RootFile::RootFile(), TFWLiteSelectorBasic::setupNewFile(), edm::BranchDescription::updateFriendlyClassName(), gen::FortranInstance::upEvnt(), gen::FortranInstance::upInit(), and gen::FortranInstance::~FortranInstance().

158  {
159  typedef tbb::concurrent_unordered_map<std::string, std::string> Map;
160  static Map s_fillToFriendlyName;
161  auto itFound = s_fillToFriendlyName.find(iFullName);
162  if(s_fillToFriendlyName.end()==itFound) {
163  itFound = s_fillToFriendlyName.insert(Map::value_type(iFullName, handleNamespaces(subFriendlyName(standardRenames(iFullName))))).first;
164  }
165  return itFound->second;
166  }
std::string subFriendlyName(std::string const &iFullName)
std::string handleNamespaces(std::string const &iIn)
Definition: FriendlyName.cc:32
std::string standardRenames(std::string const &iIn)
Definition: FriendlyName.cc:80
std::string edm::friendlyname::handleNamespaces ( std::string const &  iIn)

Definition at line 32 of file FriendlyName.cc.

References emptyString(), and reColons().

Referenced by friendlyName().

32  {
33  return std::regex_replace(iIn,reColons,emptyString);
34 
35  }
static std::regex const reColons("::")
static std::string const emptyString("")
std::string edm::friendlyname::handleTemplateArguments ( std::string const &  iIn)

Definition at line 132 of file FriendlyName.cc.

References gather_cfg::cout, reComma(), removeAllSpaces(), removeExtraSpaces(), mps_fire::result, reTemplateClass(), AlCaHLTBitMon_QueryRunRegistry::string, and subFriendlyName().

Referenced by standardRenames(), and subFriendlyName().

132  {
133  using namespace std;
135  bool shouldStop = false;
136  while(!shouldStop) {
137  if(std::string::npos != result.find_first_of("<")) {
138  smatch theMatch;
139  if(regex_search(result,theMatch,reTemplateClass)) {
140  std::string templateClass = theMatch.str(1);
141  std::string friendlierName = removeAllSpaces(subFriendlyName(templateClass));
142 
143  //std::cout <<" t: "<<templateClass <<" f:"<<friendlierName<<std::endl;
144  result = regex_replace(result, regex(templateClass),friendlierName);
145  } else {
146  //static regex const eComma(",");
147  //result = regex_replace(result,eComma,"");
148  std::cout <<" no template match for \""<<result<<"\""<<std::endl;
149  assert(nullptr =="failed to find a match for template class");
150  }
151  } else {
152  shouldStop=true;
153  }
154  }
155  result = regex_replace(result,reComma,"");
156  return result;
157  }
std::string removeAllSpaces(std::string const &iIn)
Definition: FriendlyName.cc:42
std::string subFriendlyName(std::string const &iFullName)
static std::regex const reComma(",")
static std::regex const reTemplateClass("([^<>,]+<[^<>]*>)")
std::string removeExtraSpaces(std::string const &iIn)
Definition: FriendlyName.cc:37
static std::regex const edm::friendlyname::reAIKR ( ,
*edm::helper::AssociationIdenticalKeyReference  
)
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reAllSpaces ( " +"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reArray ( "\\"  [\\])
static

Referenced by standardRenames().

static std::regex const edm::friendlyname::reBeginSpace ( "^ +"  )
static

Referenced by removeExtraSpaces().

static std::regex const edm::friendlyname::reclangabi ( "std::__1::"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reColons ( "::"  )
static

Referenced by handleNamespaces().

static std::regex const edm::friendlyname::reComma ( ,
 
)
static

Referenced by handleTemplateArguments().

static std::regex const edm::friendlyname::reCXX11 ( "std::__cxx11::"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reEndSpace ( " +$"  )
static

Referenced by removeExtraSpaces().

static std::regex const edm::friendlyname::reLong ( "long "  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reLongLong ( "Long64_t"  )
static

Referenced by removeAllSpaces().

std::string edm::friendlyname::removeAllSpaces ( std::string const &  iIn)
std::string edm::friendlyname::removeExtraSpaces ( std::string const &  iIn)

Definition at line 37 of file FriendlyName.cc.

References emptyString(), reBeginSpace(), and reEndSpace().

Referenced by handleTemplateArguments(), and subFriendlyName().

37  {
38  return std::regex_replace(std::regex_replace(iIn,reBeginSpace,emptyString),
40  }
static std::regex const reEndSpace(" +$")
static std::string const emptyString("")
static std::regex const reBeginSpace("^ +")
static std::regex const edm::friendlyname::reOneToMany ( "edm::AssociationMap< *edm::OneToMany<(.*?),(.*?), *u[a-z]*> >"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reOneToManyWithQuality ( "edm::AssociationMap<edm::OneToManyWithQuality<(.*?), *(.*?), *(.*?), *u[a-z]*> >"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reOneToOne ( "edm::AssociationMap< *edm::OneToOne<(.*?),(.*?), *u[a-z]*> >"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reOneToValue ( "edm::AssociationMap< *edm::OneToValue<(.*?),(.*?), *u[a-z]*> >"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reOwnVector ( "edm::OwnVector<(.*), *edm::ClonePolicy<\\1 *> >"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::rePointer ( "\\*"  )
static

Referenced by standardRenames().

static std::regex const edm::friendlyname::reSharedPtr ( "std::shared_ptr"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reSorted ( "edm::SortedCollection<(.*), *edm::StrictWeakOrdering<\\1 *> >"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reString ( "std::basic_string<char>"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reString2 ( "std::string"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reString3 ( "std::basic_string<char,std::char_traits<char> >"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reTemplateArgs ( "*<(.*)>$"  [^<])
static

Referenced by subFriendlyName().

static std::regex const edm::friendlyname::reTemplateClass ( "([^<>,]+<[^<>]*>)"  )
static

Referenced by handleTemplateArguments().

static std::regex const edm::friendlyname::reToRangeMap ( "edm::RangeMap< *(.*), *(.*), *edm::ClonePolicy<([^>]*)>  ,
 
)
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reToRefs1 ( "edm::RefVector< *(.*)< *(.*) *>, *\\2 *, *edm::refhelper::FindUsingAdvance< *\\1< *\\2 *> *, *\\2 *> *>"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reToRefs2 ( "edm::RefVector< *(.*) *, *(.*) *, *edm::refhelper::FindUsingAdvance< *\\1, *\\2 *> *>"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reToRefsAssoc ( "edm::RefVector< *Association(.*) *, *edm::helper(.*), *Association(.*)::Find>"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reToVector ( "edm::AssociationVector<(.*), *(.*), *edm::Ref.*,.*>"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reULongLong ( "ULong64_t"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reUniquePtr ( "std::unique_ptr"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reUnsigned ( "unsigned "  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reVector ( "std::vector"  )
static

Referenced by removeAllSpaces().

static std::regex const edm::friendlyname::reWrapper ( "edm::Wrapper<(.*)>"  )
static

Referenced by removeAllSpaces().

std::string edm::friendlyname::standardRenames ( std::string const &  iIn)

Definition at line 80 of file FriendlyName.cc.

References handleTemplateArguments(), dataset::name, reArray(), rePointer(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by friendlyName().

80  {
81  using std::regex_replace;
82  using std::regex;
83  std::string name = regex_replace(iIn, reWrapper, "$1");
84  name = regex_replace(name,rePointer,"ptr");
85  name = regex_replace(name,reArray,"As");
86  name = regex_replace(name,reAIKR,"");
87  name = regex_replace(name,reclangabi,"std::");
88  name = regex_replace(name,reCXX11,"std::");
89  name = regex_replace(name,reString,"String");
90  name = regex_replace(name,reString2,"String");
91  name = regex_replace(name,reString3,"String");
92  name = regex_replace(name,reSorted,"sSorted<$1>");
93  name = regex_replace(name,reULongLong,"ull");
94  name = regex_replace(name,reLongLong,"ll");
95  name = regex_replace(name,reUnsigned,"u");
96  name = regex_replace(name,reLong,"l");
97  name = regex_replace(name,reVector,"s");
98  name = regex_replace(name,reSharedPtr,"SharedPtr");
99  name = regex_replace(name,reUniquePtr,"UniquePtr");
100  name = regex_replace(name,reOwnVector,"sOwned<$1>");
101  name = regex_replace(name,reToVector,"AssociationVector<$1,To,$2>");
102  name = regex_replace(name,reOneToOne,"Association<$1,ToOne,$2>");
103  name = regex_replace(name,reOneToMany,"Association<$1,ToMany,$2>");
104  name = regex_replace(name,reOneToValue,"Association<$1,ToValue,$2>");
105  name = regex_replace(name,reOneToManyWithQuality,"Association<$1,ToMany,$2,WithQuantity,$3>");
106  name = regex_replace(name,reToRangeMap,"RangeMap<$1,$2>");
107  name = regex_replace(name,reToRefs1,"Refs<$1<$2>>");
108  name = regex_replace(name,reToRefs2,"Refs<$1,$2>");
109  name = regex_replace(name,reToRefsAssoc,"Refs<Association$1>");
110  //std::cout <<"standardRenames '"<<name<<"'"<<std::endl;
111  return name;
112  }
static std::regex const reToRefs1("edm::RefVector< *(.*)< *(.*) *>, *\\2 *, *edm::refhelper::FindUsingAdvance< *\\1< *\\2 *> *, *\\2 *> *>")
static std::regex const reToRangeMap("edm::RangeMap< *(.*), *(.*), *edm::ClonePolicy<([^>]*)> >")
static std::regex const reCXX11("std::__cxx11::")
static std::regex const reAIKR(", *edm::helper::AssociationIdenticalKeyReference")
static std::regex const reString3("std::basic_string<char,std::char_traits<char> >")
static std::regex const reUnsigned("unsigned ")
static std::regex const reSharedPtr("std::shared_ptr")
static std::regex const rePointer("\\*")
static std::regex const reOneToManyWithQuality("edm::AssociationMap<edm::OneToManyWithQuality<(.*?), *(.*?), *(.*?), *u[a-z]*> >")
static std::regex const reToVector("edm::AssociationVector<(.*), *(.*), *edm::Ref.*,.*>")
static std::regex const reLong("long ")
static std::regex const reOneToMany("edm::AssociationMap< *edm::OneToMany<(.*?),(.*?), *u[a-z]*> >")
static std::regex const reOwnVector("edm::OwnVector<(.*), *edm::ClonePolicy<\\1 *> >")
static std::regex const reSorted("edm::SortedCollection<(.*), *edm::StrictWeakOrdering<\\1 *> >")
static std::regex const reLongLong("Long64_t")
static std::regex const reOneToOne("edm::AssociationMap< *edm::OneToOne<(.*?),(.*?), *u[a-z]*> >")
static std::regex const reWrapper("edm::Wrapper<(.*)>")
static std::regex const reArray("\\[\\]")
static std::regex const reToRefsAssoc("edm::RefVector< *Association(.*) *, *edm::helper(.*), *Association(.*)::Find>")
static std::regex const reULongLong("ULong64_t")
static std::regex const reVector("std::vector")
static std::regex const reUniquePtr("std::unique_ptr")
static std::regex const reclangabi("std::__1::")
static std::regex const reString2("std::string")
static std::regex const reString("std::basic_string<char>")
static std::regex const reOneToValue("edm::AssociationMap< *edm::OneToValue<(.*?),(.*?), *u[a-z]*> >")
static std::regex const reToRefs2("edm::RefVector< *(.*) *, *(.*) *, *edm::refhelper::FindUsingAdvance< *\\1, *\\2 *> *>")
std::string edm::friendlyname::subFriendlyName ( std::string const &  iFullName)

Definition at line 115 of file FriendlyName.cc.

References handleTemplateArguments(), removeExtraSpaces(), mps_fire::result, reTemplateArgs(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by friendlyName(), and handleTemplateArguments().

115  {
116  using namespace std;
117  std::string result = removeExtraSpaces(iFullName);
118 
119  smatch theMatch;
120  if(regex_match(result,theMatch,reTemplateArgs)) {
121  //std::cout <<"found match \""<<theMatch.str(1) <<"\"" <<std::endl;
122  //static regex const templateClosing(">$");
123  //std::string aMatch = regex_replace(theMatch.str(1),templateClosing,"");
124  std::string aMatch = theMatch.str(1);
125  std::string theSub = handleTemplateArguments(aMatch);
126  regex const eMatch(std::string("(^[^<]*)<")+aMatch+">");
127  result = regex_replace(result,eMatch,theSub+"$1");
128  }
129  return result;
130  }
static std::regex const reTemplateArgs("[^<]*<(.*)>$")
std::string handleTemplateArguments(std::string const &)
std::string removeExtraSpaces(std::string const &iIn)
Definition: FriendlyName.cc:37