Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions FWCore/Utilities/src/FriendlyName.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,17 @@ namespace edm {
static boost::regex const reWrapper("edm::Wrapper<(.*)>");
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> >");
//The c++11 abi for gcc internally uses a different namespace for standard classes
static boost::regex const reCXX11("std::__cxx11::");
static boost::regex const reSorted("edm::SortedCollection<(.*), *edm::StrictWeakOrdering<\\1 *> >");
static boost::regex const reULongLong("ULong64_t");
static boost::regex const reLongLong("Long64_t");
static boost::regex const reUnsigned("unsigned ");
static boost::regex const reLong("long ");
static boost::regex const reVector("std::vector");
static boost::regex const reSharedPtr("std::shared_ptr");
static boost::regex const reUniquePtr("std::unique_ptr");
static boost::regex const reAIKR(", *edm::helper::AssociationIdenticalKeyReference"); //this is a default so can replaced with empty
//force first argument to also be the argument to edm::ClonePolicy so that if OwnVector is within
// a template it will not eat all the remaining '>'s
Expand All @@ -67,19 +72,24 @@ namespace edm {
static boost::regex const reToRefs2("edm::RefVector< *(.*) *, *(.*) *, *edm::refhelper::FindUsingAdvance< *\\1, *\\2 *> *>");
static boost::regex const reToRefsAssoc("edm::RefVector< *Association(.*) *, *edm::helper(.*), *Association(.*)::Find>");


std::string standardRenames(std::string const& iIn) {
using boost::regex_replace;
using boost::regex;
std::string name = regex_replace(iIn, reWrapper, "$1");
name = regex_replace(name,reAIKR,"");
name = regex_replace(name,reCXX11,"std::");
name = regex_replace(name,reString,"String");
name = regex_replace(name,reString2,"String");
name = regex_replace(name,reString3,"String");
name = regex_replace(name,reSorted,"sSorted<$1>");
name = regex_replace(name,reULongLong,"ull");
name = regex_replace(name,reLongLong,"ll");
name = regex_replace(name,reUnsigned,"u");
name = regex_replace(name,reLong,"l");
name = regex_replace(name,reVector,"s");
name = regex_replace(name,reSharedPtr,"SharedPtr");
name = regex_replace(name,reUniquePtr,"UniquePtr");
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>");
Expand Down
14 changes: 14 additions & 0 deletions FWCore/Utilities/test/friendlyname_t.cppunit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ void testfriendlyName::test()
classToFriendly.insert( Values("bar::Foo","barFoo") );
classToFriendly.insert( Values("std::vector<Foo>","Foos") );
classToFriendly.insert( Values("std::vector<bar::Foo>","barFoos") );
classToFriendly.insert( Values("std::shared_ptr<Foo>","FooSharedPtr"));
classToFriendly.insert( Values("std::shared_ptr<bar::Foo>","barFooSharedPtr"));
classToFriendly.insert( Values("std::basic_string<char>","String"));
classToFriendly.insert( Values("std::string","String"));
classToFriendly.insert( Values("std::__cxx11::basic_string<char>","String"));
classToFriendly.insert( Values("std::__cxx11::basic_string<char,std::char_traits<char> >","String"));
classToFriendly.insert( Values("std::list<int>","intstdlist"));
classToFriendly.insert( Values("std::__cxx11::list<int>","intstdlist"));
classToFriendly.insert( Values("std::vector<std::shared_ptr<bar::Foo>>","barFooSharedPtrs"));
classToFriendly.insert( Values("std::vector<std::basic_string<char>>","Strings"));
classToFriendly.insert( Values("std::__cxx11::vector<std::__cxx11::basic_string<char>>","Strings"));
classToFriendly.insert( Values("std::unique_ptr<Foo>","FooUniquePtr"));
classToFriendly.insert( Values("std::unique_ptr<bar::Foo>","barFooUniquePtr"));
classToFriendly.insert( Values("std::vector<std::unique_ptr<bar::Foo>>","barFooUniquePtrs"));
classToFriendly.insert( Values("V<A,B>","ABV") );
classToFriendly.insert( Values("edm::ExtCollection<std::vector<reco::SuperCluster>,reco::SuperClusterRefProds>","recoSuperClustersrecoSuperClusterRefProdsedmExtCollection") );
classToFriendly.insert( Values("edm::SortedCollection<EcalUncalibratedRecHit,edm::StrictWeakOrdering<EcalUncalibratedRecHit> >","EcalUncalibratedRecHitsSorted") );
Expand Down