CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
void throwMissingDictionariesException(std::vector< std::string > &missingDictionaries, std::string const &context)
void doBuildRealData(const std::string &name)
Definition: ClassFiller.cc:22
#define FDEBUG(lev)
Definition: DebugMacros.h:19
TClass * getTClass(const std::type_info &ti)
Definition: ClassFiller.cc:63
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:74
bool checkClassDictionaries(std::vector< std::string > &missingDictionaries, TypeID const &typeID)
bool loadCap(const std::string &name, std::vector< std::string > &missingDictionaries)
Definition: ClassFiller.cc:16
std::string const & className() const
Definition: TypeID.cc:40
void loadExtraClasses()
Definition: ClassFiller.cc:33