CMS 3D CMS Logo

ClassFiller.cc
Go to the documentation of this file.
7 
8 #include "TClass.h"
9 
10 #include <set>
11 #include <algorithm>
12 #include <iostream>
13 
14 namespace edm {
15 
16  bool loadCap(std::string const& name, std::vector<std::string>& missingDictionaries) {
17  FDEBUG(1) << "Loading dictionary for " << name << "\n";
18  TypeWithDict typeWithDict = TypeWithDict::byName(name);
19  return checkClassDictionaries(missingDictionaries, name, typeWithDict);
20  }
21 
23  FDEBUG(3) << "doing BuildRealData for " << name << "\n";
24  TClass* ttest = TClass::GetClass(name.c_str());
25  if (ttest != nullptr) {
26  ttest->BuildRealData();
27  } else {
28  throw edm::Exception(errors::Configuration) << "Could not find TClass for " << name << "\n";
29  }
30  }
31  // ---------------------
32 
34  static bool done = false;
35  if (done == false) {
36  std::vector<std::string> missingDictionaries;
37  loadCap(std::string("edm::StreamedProduct"), missingDictionaries);
38  loadCap(std::string("std::vector<edm::StreamedProduct>"), missingDictionaries);
39  loadCap(std::string("edm::SendEvent"), missingDictionaries);
40  loadCap(std::string("std::vector<edm::BranchDescription>"), missingDictionaries);
41  loadCap(std::string("edm::SendJobHeader"), missingDictionaries);
42  if (!missingDictionaries.empty()) {
43  std::string context("Calling loadExtraClasses, checking dictionaries");
44  throwMissingDictionariesException(missingDictionaries, context);
45  }
46  }
47  done = true;
48  }
49 
50  namespace {
51  TClass* getRootClass(std::string const& name) {
52  TClass* tc = TClass::GetClass(name.c_str());
53 
54  if (tc == nullptr) {
55  throw edm::Exception(errors::Configuration, "getRootClass") << "could not find TClass for " << name << "\n";
56  }
57 
58  return tc;
59  }
60  } // namespace
61 
62  // ---------------------
63  TClass* getTClass(std::type_info const& ti) {
64  TypeID const type(ti);
65  return getRootClass(type.className());
66  }
67 } // namespace edm
edm::TypeWithDict::byName
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:74
edm::throwMissingDictionariesException
void throwMissingDictionariesException(std::vector< std::string > &missingDictionaries, std::string const &context)
Definition: DictionaryTools.cc:193
edm::doBuildRealData
void doBuildRealData(const std::string &name)
Definition: ClassFiller.cc:22
edm
HLT enums.
Definition: AlignableModifier.h:19
TypeID.h
TypeWithDict.h
edm::checkClassDictionaries
bool checkClassDictionaries(std::vector< std::string > &missingDictionaries, TypeID const &typeID)
Definition: DictionaryTools.cc:102
EDMException.h
fileCollector.done
done
Definition: fileCollector.py:123
edm::getTClass
TClass * getTClass(const std::type_info &ti)
Definition: ClassFiller.cc:63
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::TypeWithDict
Definition: TypeWithDict.h:38
FDEBUG
#define FDEBUG(lev)
Definition: DebugMacros.h:19
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
edm::TypeID
Definition: TypeID.h:22
edm::loadCap
bool loadCap(const std::string &name, std::vector< std::string > &missingDictionaries)
Definition: ClassFiller.cc:16
Exception
Definition: hltDiff.cc:245
edm::loadExtraClasses
void loadExtraClasses()
Definition: ClassFiller.cc:33
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
ClassFiller.h
DebugMacros.h
DictionaryTools.h
edm::errors::Configuration
Definition: EDMException.h:36