Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use correct Root6 type names #2189

Merged
merged 1 commit into from Jan 27, 2014
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 20 additions & 6 deletions CondCore/ORA/src/ClassUtils.cc
Expand Up @@ -52,6 +52,18 @@ bool ora::ClassUtils::isType( const edm::TypeWithDict& type,
return ret;
}

static
void
replaceString(std::string& name, std::string const& from, std::string const& to) {
// from must not be a substring of to.
std::string::size_type length = from.size();
std::string::size_type pos = 0;
while((pos = name.find(from, pos)) != std::string::npos) {
name.replace(pos, length, to);
}
}


bool ora::ClassUtils::checkMappedType( const edm::TypeWithDict& type,
const std::string& mappedTypeName ){
if( isTypeString( type ) ){
Expand All @@ -60,13 +72,15 @@ bool ora::ClassUtils::checkMappedType( const edm::TypeWithDict& type,
return mappedTypeName=="int";
} else if ( isTypeOraVector( type ) ){
return isTypeNameOraVector( mappedTypeName );
} else if ( type.qualifiedName()=="Long64_t" ){
return (mappedTypeName=="Long64_t" || mappedTypeName=="long long");
} else if ( type.qualifiedName()=="unsigned Long64_t" ){
return (mappedTypeName=="unsigned Long64_t" || mappedTypeName=="unsigned long long");
} else {
return type.qualifiedName()==mappedTypeName;
} else if ( type.qualifiedName() == mappedTypeName ) {
return true;
}
// ROOT 6 uses these typedefs in names.
std::string typeName(mappedTypeName);
replaceString(typeName, "unsigned long long", "ULong64_t");
replaceString(typeName, "long long", "Long64_t");
replaceString(typeName, "std::basic_string<char> ", "std::string");
return (type.qualifiedName() == typeName );
}

bool ora::ClassUtils::findBaseType( edm::TypeWithDict& type, edm::TypeWithDict& baseType, size_t& func ){
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Utilities/src/TypeDemangler.cc
Expand Up @@ -132,10 +132,10 @@ namespace edm {
constBeforeIdentifier(demangledName);
// No two consecutive '>'
replaceString(demangledName, ">>", "> >");
// For ROOT 6 and beyond, replace 'long long' with 'Long64_t'
replaceString(demangledName, "long long", "Long64_t");
// For ROOT 6 and beyond, replace 'unsigned long long' with 'ULong64_t'
replaceString(demangledName, "unsigned long long", "ULong64_t");
// For ROOT 6 and beyond, replace 'long long' with 'Long64_t'
replaceString(demangledName, "long long", "Long64_t");
return demangledName;
}
}