Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:59

0001 #include <cxxabi.h>
0002 #include "DataFormats/PatCandidates/interface/UserData.h"
0003 // Note: these two below are allowed in FWLite even if they come from FWCore
0004 #include "FWCore/Reflection/interface/TypeWithDict.h"
0005 #include "FWCore/Utilities/interface/EDMException.h"
0006 
0007 void pat::UserData::checkDictionaries(const std::type_info& type) {
0008   if (!edm::hasDictionary(type)) {
0009     int status = 0;
0010     char* demangled = abi::__cxa_demangle(type.name(), nullptr, nullptr, &status);
0011     std::string typeName(status == 0 ? demangled : type.name());
0012     if ((demangled != nullptr) && (status == 0))
0013       free(demangled);
0014     throw edm::Exception(edm::errors::DictionaryNotFound)
0015         << "   No REFLEX data dictionary found for the following class:\n\t" << typeName
0016         << "\n   Most likely the dictionary was never generated,\n"
0017         << "   but it may be that it was generated in the wrong package.\n"
0018         << "   Please add (or move) the specification\n"
0019         << "\t<class name=\"" << typeName << "\" />\n"
0020         << "   to the appropriate classes_def.xml file.\n"
0021         << "   If the class is a template instance, you may need\n"
0022         << "   to define a dummy variable of this type in classes.h.\n"
0023         << "   Also, if this class has any transient members,\n"
0024         << "   you need to specify them in classes_def.xml.\n";
0025   }  // check for dictionary
0026 }
0027 
0028 std::string pat::UserData::typeNameFor(std::type_info const& iType) {
0029   int status = 0;
0030   const char* demangled = abi::__cxa_demangle(iType.name(), nullptr, nullptr, &status);
0031   return std::string(status == 0 ? demangled : "[UNKNOWN]");
0032 }