test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ParentContext.cc
Go to the documentation of this file.
7 
9 
10 #include <ostream>
11 
12 namespace edm {
13 
15  type_(Type::kInvalid) {
16  parent_.global = nullptr;
17  }
18 
20  type_(Type::kGlobal) {
21  parent_.global = global;
22  }
23 
25  type_(Type::kInternal) {
26  parent_.internal = internal;
27  }
28 
30  type_(Type::kModule) {
32  }
33 
35  type_(Type::kPlaceInPath) {
36  parent_.placeInPath = placeInPath;
37  }
38 
40  type_(Type::kStream) {
41  parent_.stream = stream;
42  }
43 
46  if(type_ != Type::kModule) {
48  << "ParentContext::moduleCallingContext called for incorrect type of context";
49  }
50  return parent_.module;
51  }
52 
53  PlaceInPathContext const*
55  if(type_ != Type::kPlaceInPath) {
57  << "ParentContext::placeInPathContext called for incorrect type of context";
58  }
59  return parent_.placeInPath;
60  }
61 
62  StreamContext const*
64  if(type_ != Type::kStream) {
66  << "ParentContext::streamContext called for incorrect type of context";
67  }
68  return parent_.stream;
69  }
70 
71  GlobalContext const*
73  if(type_ != Type::kGlobal) {
75  << "ParentContext::globalContext called for incorrect type of context";
76  }
77  return parent_.global;
78  }
79 
80  InternalContext const*
82  if(type_ != Type::kInternal) {
84  << "ParentContext::internalContext called for incorrect type of context";
85  }
86  return parent_.internal;
87  }
88 
89  std::ostream& operator<<(std::ostream& os, ParentContext const& pc) {
90  if(pc.type() == ParentContext::Type::kGlobal && pc.globalContext()) {
91  os << *pc.globalContext();
92  } else if (pc.type() == ParentContext::Type::kInternal && pc.internalContext()) {
93  os << *pc.internalContext();
94  } else if (pc.type() == ParentContext::Type::kModule && pc.moduleCallingContext()) {
95  os << *pc.moduleCallingContext();
96  } else if (pc.type() == ParentContext::Type::kPlaceInPath && pc.placeInPathContext()) {
97  os << *pc.placeInPathContext();
98  } else if (pc.type() == ParentContext::Type::kStream && pc.streamContext()) {
99  os << *pc.streamContext();
100  } else if (pc.type() == ParentContext::Type::kInvalid) {
101  os << "ParentContext invalid\n";
102  }
103  return os;
104  }
105 }
Type type() const
Definition: ParentContext.h:46
ModuleCallingContext const * module
Definition: ParentContext.h:60
union edm::ParentContext::Parent parent_
StreamContext const * stream
Definition: ParentContext.h:62
ModuleCallingContext const * moduleCallingContext() const
InternalContext const * internal
Definition: ParentContext.h:59
PlaceInPathContext const * placeInPathContext() const
PlaceInPathContext const * placeInPath
Definition: ParentContext.h:61
InternalContext const * internalContext() const
StreamContext const * streamContext() const
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
GlobalContext const * globalContext() const
Definition: vlib.h:208
GlobalContext const * global
Definition: ParentContext.h:58