test
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  checkClassDictionaries(type, true);
19  if (!missingTypes().empty()) {
21  missingTypes().clear();
22  for_all(missing, loadType);
23  }
24  }
25 
26  void loadCap(std::string const& name) {
27  FDEBUG(1) << "Loading dictionary for " << name << "\n";
28  TypeWithDict typedict = TypeWithDict::byName(name);
29  if (!typedict) {
30  throw cms::Exception("DictionaryMissingClass") << "The dictionary of class '" << name << "' is missing!";
31  }
32  TClass* cl = TClass::GetClass(name.c_str());
33  loadType(TypeID(*cl->GetTypeInfo()));
34  }
35 
37  FDEBUG(3) << "doing BuildRealData for " << name << "\n";
38  TClass* ttest = TClass::GetClass(name.c_str());
39  if (ttest != 0) {
40  ttest->BuildRealData();
41  } else {
43  << "Could not find TClass for " << name << "\n";
44  }
45  }
46  // ---------------------
47 
49  static bool done = false;
50  if (done == false) {
51  loadCap(std::string("edm::StreamedProduct"));
52  loadCap(std::string("std::vector<edm::StreamedProduct>"));
53  loadCap(std::string("edm::SendEvent"));
54  loadCap(std::string("std::vector<edm::BranchDescription>"));
55  loadCap(std::string("edm::SendJobHeader"));
56  }
57  done=true;
58  }
59 
60  namespace {
61  TClass* getRootClass(std::string const& name) {
62  TClass* tc = TClass::GetClass(name.c_str());
63 
64  // get ROOT TClass for this product
65  // CINT::Type* cint_type = CINT::Type::get(typ_ref);
66  // tc_ = cint_type->rootClass();
67  // TClass* tc = TClass::GetClass(typeid(se));
68  // tc_ = TClass::GetClass("edm::SendEvent");
69 
70  if(tc == 0) {
71  throw edm::Exception(errors::Configuration,"getRootClass")
72  << "could not find TClass for " << name
73  << "\n";
74  }
75 
76  return tc;
77  }
78  }
79 
80  // ---------------------
81  TClass* getTClass(std::type_info const& ti) {
82  TypeID const type(ti);
83  return getRootClass(type.className());
84  }
85 }
type
Definition: HCALResponse.h:21
dictionary missing
Definition: combine.py:4
void loadType(TypeID const &type)
Definition: ClassFiller.cc:17
void checkClassDictionaries(TypeID const &type, bool recursive=true)
void doBuildRealData(const std::string &name)
Definition: ClassFiller.cc:36
#define FDEBUG(lev)
Definition: DebugMacros.h:18
TClass * getTClass(const std::type_info &ti)
Definition: ClassFiller.cc:81
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
TypeSet & missingTypes()
std::string const & className() const
Definition: TypeID.cc:46
void loadExtraClasses()
Definition: ClassFiller.cc:48
void loadCap(const std::string &name)
Definition: ClassFiller.cc:26