CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 boost::regex const reAIKR (", *edm::helper::AssociationIdenticalKeyReference")
 
static boost::regex const reAllSpaces (" +")
 
static boost::regex const reBeginSpace ("^ +")
 
static boost::regex const reColons ("::")
 
static boost::regex const reComma (",")
 
static boost::regex const reCXX11 ("std::__cxx11::")
 
static boost::regex const reEndSpace (" +$")
 
static boost::regex const reLong ("long ")
 
static boost::regex const reLongLong ("Long64_t")
 
std::string removeAllSpaces (std::string const &iIn)
 
std::string removeExtraSpaces (std::string const &iIn)
 
static boost::regex const reOneToMany ("edm::AssociationMap< *edm::OneToMany<(.*?),(.*?), *u[a-z]*> >")
 
static boost::regex const reOneToManyWithQuality ("edm::AssociationMap<edm::OneToManyWithQuality<(.*?), *(.*?), *(.*?), *u[a-z]*> >")
 
static boost::regex const reOneToOne ("edm::AssociationMap< *edm::OneToOne<(.*?),(.*?), *u[a-z]*> >")
 
static boost::regex const reOneToValue ("edm::AssociationMap< *edm::OneToValue<(.*?),(.*?), *u[a-z]*> >")
 
static boost::regex const reOwnVector ("edm::OwnVector<(.*), *edm::ClonePolicy<\\1 *> >")
 
static boost::regex const reSharedPtr ("std::shared_ptr")
 
static boost::regex const reSorted ("edm::SortedCollection<(.*), *edm::StrictWeakOrdering<\\1 *> >")
 
static boost::regex const reString ("std::basic_string<char>")
 
static boost::regex const reString2 ("std::string")
 
static boost::regex const reString3 ("std::basic_string<char,std::char_traits<char> >")
 
static boost::regex const reTemplateArgs ("[^<]*<(.*)>$")
 
static boost::regex const reTemplateClass ("([^<>,]+<[^<>]*>)")
 
static boost::regex const reToRangeMap ("edm::RangeMap< *(.*), *(.*), *edm::ClonePolicy<([^>]*)> >")
 
static boost::regex const reToRefs1 ("edm::RefVector< *(.*)< *(.*) *>, *\\2 *, *edm::refhelper::FindUsingAdvance< *\\1< *\\2 *> *, *\\2 *> *>")
 
static boost::regex const reToRefs2 ("edm::RefVector< *(.*) *, *(.*) *, *edm::refhelper::FindUsingAdvance< *\\1, *\\2 *> *>")
 
static boost::regex const reToRefsAssoc ("edm::RefVector< *Association(.*) *, *edm::helper(.*), *Association(.*)::Find>")
 
static boost::regex const reToVector ("edm::AssociationVector<(.*), *(.*), *edm::Ref.*,.*>")
 
static boost::regex const reULongLong ("ULong64_t")
 
static boost::regex const reUniquePtr ("std::unique_ptr")
 
static boost::regex const reUnsigned ("unsigned ")
 
static boost::regex const reVector ("std::vector")
 
static boost::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 151 of file FriendlyName.cc.

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

Referenced by edm::EventContentAnalyzer::analyze(), gen::FortranInstance::enter(), 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().

151  {
152  typedef tbb::concurrent_unordered_map<std::string, std::string> Map;
153  static Map s_fillToFriendlyName;
154  auto itFound = s_fillToFriendlyName.find(iFullName);
155  if(s_fillToFriendlyName.end()==itFound) {
156  itFound = s_fillToFriendlyName.insert(Map::value_type(iFullName, handleNamespaces(subFriendlyName(standardRenames(iFullName))))).first;
157  }
158  return itFound->second;
159  }
std::string subFriendlyName(std::string const &iFullName)
std::string handleNamespaces(std::string const &iIn)
Definition: FriendlyName.cc:29
std::string standardRenames(std::string const &iIn)
Definition: FriendlyName.cc:76
std::string edm::friendlyname::handleNamespaces ( std::string const &  iIn)

Definition at line 29 of file FriendlyName.cc.

References emptyString(), and reColons().

Referenced by friendlyName().

29  {
30  return boost::regex_replace(iIn,reColons,emptyString,boost::format_perl);
31 
32  }
static boost::regex const reColons("::")
static std::string const emptyString("")
std::string edm::friendlyname::handleTemplateArguments ( std::string const &  iIn)

Definition at line 125 of file FriendlyName.cc.

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

Referenced by subFriendlyName().

125  {
126  using namespace boost;
128  bool shouldStop = false;
129  while(!shouldStop) {
130  if(std::string::npos != result.find_first_of("<")) {
131  smatch theMatch;
132  if(regex_search(result,theMatch,reTemplateClass)) {
133  std::string templateClass = theMatch.str(1);
134  std::string friendlierName = removeAllSpaces(subFriendlyName(templateClass));
135 
136  //std::cout <<" t: "<<templateClass <<" f:"<<friendlierName<<std::endl;
137  result = regex_replace(result, regex(templateClass),friendlierName);
138  } else {
139  //static regex const eComma(",");
140  //result = regex_replace(result,eComma,"");
141  std::cout <<" no template match for \""<<result<<"\""<<std::endl;
142  assert(0 =="failed to find a match for template class");
143  }
144  } else {
145  shouldStop=true;
146  }
147  }
148  result = regex_replace(result,reComma,"");
149  return result;
150  }
assert(m_qm.get())
std::string removeAllSpaces(std::string const &iIn)
Definition: FriendlyName.cc:39
std::string subFriendlyName(std::string const &iFullName)
static boost::regex const reTemplateClass("([^<>,]+<[^<>]*>)")
tuple result
Definition: mps_fire.py:84
static boost::regex const reComma(",")
tuple cout
Definition: gather_cfg.py:145
std::string removeExtraSpaces(std::string const &iIn)
Definition: FriendlyName.cc:34
static boost::regex const edm::friendlyname::reAIKR ( ,
*edm::helper::AssociationIdenticalKeyReference  
)
static

Referenced by standardRenames().

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

Referenced by removeAllSpaces().

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

Referenced by removeExtraSpaces().

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

Referenced by handleNamespaces().

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

Referenced by handleTemplateArguments().

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

Referenced by standardRenames().

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

Referenced by removeExtraSpaces().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Definition at line 39 of file FriendlyName.cc.

References emptyString(), and reAllSpaces().

Referenced by handleTemplateArguments().

39  {
40  return boost::regex_replace(iIn, reAllSpaces,emptyString);
41  }
static boost::regex const reAllSpaces(" +")
static std::string const emptyString("")
std::string edm::friendlyname::removeExtraSpaces ( std::string const &  iIn)

Definition at line 34 of file FriendlyName.cc.

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

Referenced by handleTemplateArguments(), and subFriendlyName().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Referenced by subFriendlyName().

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

Referenced by handleTemplateArguments().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Referenced by standardRenames().

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

Definition at line 76 of file FriendlyName.cc.

References mergeVDriftHistosByStation::name, reAIKR(), reCXX11(), reLong(), reLongLong(), reOneToMany(), reOneToManyWithQuality(), reOneToOne(), reOneToValue(), reOwnVector(), reSharedPtr(), reSorted(), reString(), reString2(), reString3(), reToRangeMap(), reToRefs1(), reToRefs2(), reToRefsAssoc(), reToVector(), reULongLong(), reUniquePtr(), reUnsigned(), reVector(), reWrapper(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by friendlyName().

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

Definition at line 108 of file FriendlyName.cc.

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

Referenced by friendlyName(), and handleTemplateArguments().

108  {
109  using namespace boost;
110  std::string result = removeExtraSpaces(iFullName);
111 
112  smatch theMatch;
113  if(regex_match(result,theMatch,reTemplateArgs)) {
114  //std::cout <<"found match \""<<theMatch.str(1) <<"\"" <<std::endl;
115  //static regex const templateClosing(">$");
116  //std::string aMatch = regex_replace(theMatch.str(1),templateClosing,"");
117  std::string aMatch = theMatch.str(1);
118  std::string theSub = handleTemplateArguments(aMatch);
119  regex const eMatch(std::string("(^[^<]*)<")+aMatch+">");
120  result = regex_replace(result,eMatch,theSub+"$1");
121  }
122  return result;
123  }
static boost::regex const reTemplateArgs("[^<]*<(.*)>$")
tuple result
Definition: mps_fire.py:84
std::string handleTemplateArguments(std::string const &)
std::string removeExtraSpaces(std::string const &iIn)
Definition: FriendlyName.cc:34