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 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::getInputTag(), L1GtUtils::getL1GtTriggerMenuLiteInputTag(), gen::FortranInstance::leave(), main(), edm::RootFile::RootFile(), TFWLiteSelectorBasic::setupNewFile(), edm::BranchDescription::updateFriendlyClassName(), gen::FortranInstance::upEvnt(), gen::FortranInstance::upInit(), and gen::FortranInstance::~FortranInstance().

                                                       {
       typedef std::map<std::string, std::string> Map;
       static boost::thread_specific_ptr<Map> s_fillToFriendlyName;
       if(0 == s_fillToFriendlyName.get()){
          s_fillToFriendlyName.reset(new Map);
       }
       Map::const_iterator itFound = s_fillToFriendlyName->find(iFullName);
       if(s_fillToFriendlyName->end()==itFound) {
          itFound = s_fillToFriendlyName->insert(Map::value_type(iFullName, handleNamespaces(subFriendlyName(standardRenames(iFullName))))).first;
       }
       return itFound->second;
    }
std::string edm::friendlyname::handleNamespaces ( std::string const &  iIn)

Definition at line 30 of file FriendlyName.cc.

References emptyString(), and reColons().

Referenced by friendlyName().

                                                     {
       return boost::regex_replace(iIn,reColons,emptyString,boost::format_perl);

    }
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(), and subFriendlyName().

Referenced by subFriendlyName().

                                                            {
       using namespace boost;
       std::string result = removeExtraSpaces(iIn);
       bool shouldStop = false;
       while(!shouldStop) {
          if(std::string::npos != result.find_first_of("<")) {
             smatch theMatch;
             if(regex_search(result,theMatch,reTemplateClass)) {
                std::string templateClass = theMatch.str(1);
                std::string friendlierName = removeAllSpaces(subFriendlyName(templateClass));
               
                //std::cout <<" t: "<<templateClass <<" f:"<<friendlierName<<std::endl;
                result = regex_replace(result, regex(templateClass),friendlierName);
             } else {
                //static regex const eComma(",");
                //result = regex_replace(result,eComma,"");
                std::cout <<" no template match for \""<<result<<"\""<<std::endl;
                assert(0 =="failed to find a match for template class");
             }
          } else {
             shouldStop=true;
          }
       }
       result = regex_replace(result,reComma,"");
       return result;
    }
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().

                                                    {
      return boost::regex_replace(iIn, reAllSpaces,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().

                                                      {
       return boost::regex_replace(boost::regex_replace(iIn,reBeginSpace,emptyString),
                                    reEndSpace, emptyString);
    }
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(), and reWrapper().

Referenced by friendlyName().

                                                    {
       using boost::regex_replace;
       using boost::regex;
       std::string name = regex_replace(iIn, reWrapper, "$1");
       name = regex_replace(name,reAIKR,"");
       name = regex_replace(name,reString,"String");
       name = regex_replace(name,reSorted,"sSorted<$1>");
       name = regex_replace(name,reUnsigned,"u");
       name = regex_replace(name,reLong,"l");
       name = regex_replace(name,reVector,"s");
       name = regex_replace(name,reOwnVector,"sOwned<$1>");
       name = regex_replace(name,reToVector,"AssociationVector<$1,To,$2>");
       name = regex_replace(name,reOneToOne,"Association<$1,ToOne,$2>");
       name = regex_replace(name,reOneToMany,"Association<$1,ToMany,$2>");
       name = regex_replace(name,reOneToValue,"Association<$1,ToValue,$2>");
       name = regex_replace(name,reOneToManyWithQuality,"Association<$1,ToMany,$2,WithQuantity,$3>");
       name = regex_replace(name,reToRangeMap,"RangeMap<$1,$2>");
       name = regex_replace(name,reToRefs1,"Refs<$1<$2>>");
       name = regex_replace(name,reToRefs2,"Refs<$1,$2>");
       name = regex_replace(name,reToRefsAssoc,"Refs<Association$1>");
       //std::cout <<"standardRenames '"<<name<<"'"<<std::endl;
       return name;
    }
std::string edm::friendlyname::subFriendlyName ( std::string const &  iFullName)

Definition at line 93 of file FriendlyName.cc.

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

Referenced by friendlyName(), and handleTemplateArguments().

                                                          {
       using namespace boost;
       std::string result = removeExtraSpaces(iFullName);

       smatch theMatch;
       if(regex_match(result,theMatch,reTemplateArgs)) {
          //std::cout <<"found match \""<<theMatch.str(1) <<"\"" <<std::endl;
          //static regex const templateClosing(">$");
          //std::string aMatch = regex_replace(theMatch.str(1),templateClosing,"");
          std::string aMatch = theMatch.str(1);
          std::string theSub = handleTemplateArguments(aMatch);
          regex const eMatch(std::string("(^[^<]*)<")+aMatch+">");
          result = regex_replace(result,eMatch,theSub+"$1");
       }
       return result;
    }