CMS 3D CMS Logo

ParentContext.cc
Go to the documentation of this file.
8 
10 
11 #include <ostream>
12 
13 namespace edm {
14 
16  type_(Type::kInvalid) {
17  parent_.global = nullptr;
18  }
19 
21  type_(Type::kGlobal) {
22  parent_.global = global;
23  }
24 
26  type_(Type::kInternal) {
27  parent_.internal = internal;
28  }
29 
31  type_(Type::kModule) {
32  parent_.module = module;
33  }
34 
36  type_(Type::kPlaceInPath) {
37  parent_.placeInPath = placeInPath;
38  }
39 
41  type_(Type::kStream) {
42  parent_.stream = stream;
43  }
44 
47  if(type_ != Type::kModule) {
49  << "ParentContext::moduleCallingContext called for incorrect type of context";
50  }
51  return parent_.module;
52  }
53 
54  PlaceInPathContext const*
56  if(type_ != Type::kPlaceInPath) {
58  << "ParentContext::placeInPathContext called for incorrect type of context";
59  }
60  return parent_.placeInPath;
61  }
62 
63  StreamContext const*
65  if(type_ != Type::kStream) {
67  << "ParentContext::streamContext called for incorrect type of context";
68  }
69  return parent_.stream;
70  }
71 
72  GlobalContext const*
74  if(type_ != Type::kGlobal) {
76  << "ParentContext::globalContext called for incorrect type of context";
77  }
78  return parent_.global;
79  }
80 
81  InternalContext const*
83  if(type_ != Type::kInternal) {
85  << "ParentContext::internalContext called for incorrect type of context";
86  }
87  return parent_.internal;
88  }
89 
90  bool
92  switch(type_) {
93  case Type::kGlobal:
94  {
96  }
97  case Type::kModule:
98  {
100  }
101  case Type::kStream:
102  {
103  return parent_.stream->isAtEndTransition();
104  }
105  case Type::kPlaceInPath:
106  {
108  }
109  default:
110  break;
111  }
112  return false;
113  }
114 
115  std::ostream& operator<<(std::ostream& os, ParentContext const& pc) {
116  if(pc.type() == ParentContext::Type::kGlobal && pc.globalContext()) {
117  os << *pc.globalContext();
118  } else if (pc.type() == ParentContext::Type::kInternal && pc.internalContext()) {
119  os << *pc.internalContext();
120  } else if (pc.type() == ParentContext::Type::kModule && pc.moduleCallingContext()) {
121  os << *pc.moduleCallingContext();
122  } else if (pc.type() == ParentContext::Type::kPlaceInPath && pc.placeInPathContext()) {
123  os << *pc.placeInPathContext();
124  } else if (pc.type() == ParentContext::Type::kStream && pc.streamContext()) {
125  os << *pc.streamContext();
126  } else if (pc.type() == ParentContext::Type::kInvalid) {
127  os << "ParentContext invalid\n";
128  }
129  return os;
130  }
131 }
Type type() const
Definition: ParentContext.h:46
bool isAtEndTransition() const
Definition: GlobalContext.h:52
bool isAtEndTransition() const
ModuleCallingContext const * module
Definition: ParentContext.h:62
union edm::ParentContext::Parent parent_
StreamContext const * stream
Definition: ParentContext.h:64
ModuleCallingContext const * moduleCallingContext() const
InternalContext const * internal
Definition: ParentContext.h:61
PlaceInPathContext const * placeInPathContext() const
ParentContext const & parent() const
PathContext const * pathContext() const
PlaceInPathContext const * placeInPath
Definition: ParentContext.h:63
bool isAtEndTransition() const
Definition: StreamContext.h:59
InternalContext const * internalContext() const
StreamContext const * streamContext() const
StreamContext const * streamContext() const
Definition: PathContext.h:38
HLT enums.
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:60