CMS 3D CMS Logo

ErrorThrower.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FWLite
4 // Class : ErrorThrower
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Tue Sep 23 10:06:39 EDT 2008
11 //
12 
13 // system include files
14 
15 // user include files
19 #include <ostream>
20 
21 using namespace fwlite;
22 //
23 // constants, enums and typedefs
24 //
25 namespace {
26  class NoProductErrorThrower : public ErrorThrower {
27  public:
28  NoProductErrorThrower(const std::type_info& iType, const char* iModule, const char* iInstance, const char* iProcess)
29  : type_(&iType), module_(iModule), instance_(iInstance), process_(iProcess) {}
30 
31  void throwIt() const override {
32  edm::TypeID type(*type_);
34  << "A branch was found for \n type ='" << type.className() << "'\n module='" << module_
35  << "'\n productInstance='" << ((nullptr != instance_) ? instance_ : "") << "'\n process='"
36  << ((nullptr != process_) ? process_ : "")
37  << "'\n"
38  "but no data is available for this Event";
39  }
40  ErrorThrower* clone() const override { return new NoProductErrorThrower(*this); }
41 
42  private:
43  const std::type_info* type_;
44  const char* module_;
45  const char* instance_;
46  const char* process_;
47  };
48 
49  class NoBranchErrorThrower : public ErrorThrower {
50  public:
51  NoBranchErrorThrower(const std::type_info& iType, const char* iModule, const char* iInstance, const char* iProcess)
52  : type_(&iType), module_(iModule), instance_(iInstance), process_(iProcess) {}
53 
54  void throwIt() const override {
55  edm::TypeID type(*type_);
57  << "No branch was found for \n type ='" << type.className() << "'\n module='" << module_
58  << "'\n productInstance='" << ((nullptr != instance_) ? instance_ : "") << "'\n process='"
59  << ((nullptr != process_) ? process_ : "") << "'";
60  }
61 
62  ErrorThrower* clone() const override { return new NoBranchErrorThrower(*this); }
63 
64  private:
65  const std::type_info* type_;
66  const char* module_;
67  const char* instance_;
68  const char* process_;
69  };
70 
71  class UnsetErrorThrower : public ErrorThrower {
72  void throwIt() const override { throw cms::Exception("UnsetHandle") << "The fwlite::Handle was never set"; }
73 
74  ErrorThrower* clone() const override { return new UnsetErrorThrower(*this); }
75  };
76 } // namespace
77 //
78 // static data member definitions
79 //
80 
81 //
82 // constructors and destructor
83 //
85 
86 // ErrorThrower::ErrorThrower(const ErrorThrower& rhs)
87 // {
88 // // do actual copying here;
89 // }
90 
92 
93 //
94 // assignment operators
95 //
96 // const ErrorThrower& ErrorThrower::operator=(const ErrorThrower& rhs)
97 // {
98 // //An exception safe implementation is
99 // ErrorThrower temp(rhs);
100 // swap(rhs);
101 //
102 // return *this;
103 // }
104 
105 //
106 // member functions
107 //
108 
109 //
110 // const member functions
111 //
112 
113 //
114 // static member functions
115 //
116 ErrorThrower* ErrorThrower::unsetErrorThrower() { return new UnsetErrorThrower(); }
117 
119  const char* iModule,
120  const char* iInstance,
121  const char* iProcess) {
122  return new NoBranchErrorThrower(iType, iModule, iInstance, iProcess);
123 }
124 
126  const char* iModule,
127  const char* iInstance,
128  const char* iProcess) {
129  return new NoProductErrorThrower(iType, iModule, iInstance, iProcess);
130 }
static const char module_[]
static ErrorThrower * unsetErrorThrower()
static ErrorThrower * errorThrowerBranchNotFoundException(const std::type_info &, const char *, const char *, const char *)
static ErrorThrower * errorThrowerProductNotFoundException(const std::type_info &, const char *, const char *, const char *)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135