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 reEndSpace (" +$")
 
static boost::regex const reLong ("long ")
 
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 reSorted ("edm::SortedCollection<(.*), *edm::StrictWeakOrdering<\\1 *> >")
 
static boost::regex const reString ("std::basic_string<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 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 136 of file FriendlyName.cc.

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

Referenced by edm::EventContentAnalyzer::analyze(), gen::FortranInstance::enter(), edm::TypeID::friendlyClassName(), L1GtUtils::getL1GtRecordInputTag(), L1GtUtils::getL1GtTriggerMenuLiteInputTag(), gen::FortranInstance::leave(), main(), edm::RootFile::RootFile(), TFWLiteSelectorBasic::setupNewFile(), edm::BranchDescription::updateFriendlyClassName(), gen::FortranInstance::upEvnt(), gen::FortranInstance::upInit(), and gen::FortranInstance::~FortranInstance().

136  {
137  typedef std::map<std::string, std::string> Map;
138  static boost::thread_specific_ptr<Map> s_fillToFriendlyName;
139  if(0 == s_fillToFriendlyName.get()){
140  s_fillToFriendlyName.reset(new Map);
141  }
142  Map::const_iterator itFound = s_fillToFriendlyName->find(iFullName);
143  if(s_fillToFriendlyName->end()==itFound) {
144  itFound = s_fillToFriendlyName->insert(Map::value_type(iFullName, handleNamespaces(subFriendlyName(standardRenames(iFullName))))).first;
145  }
146  return itFound->second;
147  }
std::string subFriendlyName(std::string const &iFullName)
Definition: FriendlyName.cc:93
std::string handleNamespaces(std::string const &iIn)
Definition: FriendlyName.cc:30
Container::value_type value_type
std::string standardRenames(std::string const &iIn)
Definition: FriendlyName.cc:68
std::string edm::friendlyname::handleNamespaces ( std::string const &  iIn)

Definition at line 30 of file FriendlyName.cc.

References emptyString(), and reColons().

Referenced by friendlyName().

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

Definition at line 110 of file FriendlyName.cc.

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

Referenced by subFriendlyName().

110  {
111  using namespace boost;
113  bool shouldStop = false;
114  while(!shouldStop) {
115  if(std::string::npos != result.find_first_of("<")) {
116  smatch theMatch;
117  if(regex_search(result,theMatch,reTemplateClass)) {
118  std::string templateClass = theMatch.str(1);
119  std::string friendlierName = removeAllSpaces(subFriendlyName(templateClass));
120 
121  //std::cout <<" t: "<<templateClass <<" f:"<<friendlierName<<std::endl;
122  result = regex_replace(result, regex(templateClass),friendlierName);
123  } else {
124  //static regex const eComma(",");
125  //result = regex_replace(result,eComma,"");
126  std::cout <<" no template match for \""<<result<<"\""<<std::endl;
127  assert(0 =="failed to find a match for template class");
128  }
129  } else {
130  shouldStop=true;
131  }
132  }
133  result = regex_replace(result,reComma,"");
134  return result;
135  }
std::string removeAllSpaces(std::string const &iIn)
Definition: FriendlyName.cc:40
std::string subFriendlyName(std::string const &iFullName)
Definition: FriendlyName.cc:93
static boost::regex const reTemplateClass("([^<>,]+<[^<>]*>)")
tuple result
Definition: query.py:137
static boost::regex const reComma(",")
tuple cout
Definition: gather_cfg.py:121
std::string removeExtraSpaces(std::string const &iIn)
Definition: FriendlyName.cc:35
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::reEndSpace ( " +$"  )
static

Referenced by removeExtraSpaces().

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

Referenced by standardRenames().

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

Definition at line 40 of file FriendlyName.cc.

References emptyString(), and reAllSpaces().

Referenced by handleTemplateArguments().

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

Definition at line 35 of file FriendlyName.cc.

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

Referenced by handleTemplateArguments(), and subFriendlyName().

35  {
36  return boost::regex_replace(boost::regex_replace(iIn,reBeginSpace,emptyString),
38  }
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::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::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::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 68 of file FriendlyName.cc.

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

Referenced by friendlyName().

68  {
69  using boost::regex_replace;
70  using boost::regex;
71  std::string name = regex_replace(iIn, reWrapper, "$1");
72  name = regex_replace(name,reAIKR,"");
73  name = regex_replace(name,reString,"String");
74  name = regex_replace(name,reSorted,"sSorted<$1>");
75  name = regex_replace(name,reUnsigned,"u");
76  name = regex_replace(name,reLong,"l");
77  name = regex_replace(name,reVector,"s");
78  name = regex_replace(name,reOwnVector,"sOwned<$1>");
79  name = regex_replace(name,reToVector,"AssociationVector<$1,To,$2>");
80  name = regex_replace(name,reOneToOne,"Association<$1,ToOne,$2>");
81  name = regex_replace(name,reOneToMany,"Association<$1,ToMany,$2>");
82  name = regex_replace(name,reOneToValue,"Association<$1,ToValue,$2>");
83  name = regex_replace(name,reOneToManyWithQuality,"Association<$1,ToMany,$2,WithQuantity,$3>");
84  name = regex_replace(name,reToRangeMap,"RangeMap<$1,$2>");
85  name = regex_replace(name,reToRefs1,"Refs<$1<$2>>");
86  name = regex_replace(name,reToRefs2,"Refs<$1,$2>");
87  name = regex_replace(name,reToRefsAssoc,"Refs<Association$1>");
88  //std::cout <<"standardRenames '"<<name<<"'"<<std::endl;
89  return name;
90  }
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 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 reOneToMany("edm::AssociationMap< *edm::OneToMany<(.*?),(.*?), *u[a-z]*> >")
static boost::regex const reOneToOne("edm::AssociationMap< *edm::OneToOne<(.*?),(.*?), *u[a-z]*> >")
static boost::regex const reVector("std::vector")
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 reString("std::basic_string<char>")
static boost::regex const reWrapper("edm::Wrapper<(.*)>")
static boost::regex const reToRefsAssoc("edm::RefVector< *Association(.*) *, *edm::helper(.*), *Association(.*)::Find>")
std::string edm::friendlyname::subFriendlyName ( std::string const &  iFullName)

Definition at line 93 of file FriendlyName.cc.

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

Referenced by friendlyName(), and handleTemplateArguments().

93  {
94  using namespace boost;
96 
97  smatch theMatch;
98  if(regex_match(result,theMatch,reTemplateArgs)) {
99  //std::cout <<"found match \""<<theMatch.str(1) <<"\"" <<std::endl;
100  //static regex const templateClosing(">$");
101  //std::string aMatch = regex_replace(theMatch.str(1),templateClosing,"");
102  std::string aMatch = theMatch.str(1);
103  std::string theSub = handleTemplateArguments(aMatch);
104  regex const eMatch(std::string("(^[^<]*)<")+aMatch+">");
105  result = regex_replace(result,eMatch,theSub+"$1");
106  }
107  return result;
108  }
static boost::regex const reTemplateArgs("[^<]*<(.*)>$")
tuple result
Definition: query.py:137
std::string handleTemplateArguments(std::string const &)
std::string removeExtraSpaces(std::string const &iIn)
Definition: FriendlyName.cc:35