CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ClassFiller.cc
Go to the documentation of this file.
8 
9 #include "TClass.h"
10 
11 #include <string>
12 #include <set>
13 #include <algorithm>
14 #include <iostream>
15 
16 namespace edm {
17  void loadType(TypeID const& type) {
18  TypeSet missingTypes;
19  checkClassDictionaries(type,missingTypes,true);
20  if (!missingTypes.empty()) {
21  for_all(missingTypes, loadType);
22  }
23  }
24 
25  void loadCap(std::string const& name) {
26  FDEBUG(1) << "Loading dictionary for " << name << "\n";
27  TypeWithDict typedict = TypeWithDict::byName(name);
28  if (!typedict) {
29  throw cms::Exception("DictionaryMissingClass") << "The dictionary of class '" << name << "' is missing!";
30  }
31  TClass* cl = TClass::GetClass(name.c_str());
32  loadType(TypeID(*cl->GetTypeInfo()));
33  }
34 
36  FDEBUG(3) << "doing BuildRealData for " << name << "\n";
37  TClass* ttest = TClass::GetClass(name.c_str());
38  if (ttest != 0) {
39  ttest->BuildRealData();
40  } else {
42  << "Could not find TClass for " << name << "\n";
43  }
44  }
45  // ---------------------
46 
48  static bool done = false;
49  if (done == false) {
50  loadCap(std::string("edm::StreamedProduct"));
51  loadCap(std::string("std::vector<edm::StreamedProduct>"));
52  loadCap(std::string("edm::SendEvent"));
53  loadCap(std::string("std::vector<edm::BranchDescription>"));
54  loadCap(std::string("edm::SendJobHeader"));
55  }
56  done=true;
57  }
58 
59  namespace {
60  TClass* getRootClass(std::string const& name) {
61  TClass* tc = TClass::GetClass(name.c_str());
62 
63  if(tc == 0) {
64  throw edm::Exception(errors::Configuration,"getRootClass")
65  << "could not find TClass for " << name
66  << "\n";
67  }
68 
69  return tc;
70  }
71  }
72 
73  // ---------------------
74  TClass* getTClass(std::type_info const& ti) {
75  TypeID const type(ti);
76  return getRootClass(type.className());
77  }
78 }
type
Definition: HCALResponse.h:21
void loadType(TypeID const &type)
Definition: ClassFiller.cc:17
void doBuildRealData(const std::string &name)
Definition: ClassFiller.cc:35
#define FDEBUG(lev)
Definition: DebugMacros.h:18
TClass * getTClass(const std::type_info &ti)
Definition: ClassFiller.cc:74
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:60
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
std::set< TypeID > TypeSet
std::string const & className() const
Definition: TypeID.cc:46
void checkClassDictionaries(TypeID const &type, TypeSet &missingTypes, bool recursive=true)
void loadExtraClasses()
Definition: ClassFiller.cc:47
void loadCap(const std::string &name)
Definition: ClassFiller.cc:25