CMS 3D CMS Logo

ParentContext.cc
Go to the documentation of this file.
8 
10 
11 #include <ostream>
12 
13 namespace edm {
14 
15  ParentContext::ParentContext() : type_(Type::kInvalid) { parent_.global = nullptr; }
16 
17  ParentContext::ParentContext(GlobalContext const* global) : type_(Type::kGlobal) { parent_.global = global; }
18 
19  ParentContext::ParentContext(InternalContext const* internal) : type_(Type::kInternal) {
20  parent_.internal = internal;
21  }
22 
24 
25  ParentContext::ParentContext(PlaceInPathContext const* placeInPath) : type_(Type::kPlaceInPath) {
26  parent_.placeInPath = placeInPath;
27  }
28 
30 
32  if (type_ != Type::kModule) {
33  throw Exception(errors::LogicError) << "ParentContext::moduleCallingContext called for incorrect type of context";
34  }
35  return parent_.module;
36  }
37 
39  if (type_ != Type::kPlaceInPath) {
40  throw Exception(errors::LogicError) << "ParentContext::placeInPathContext called for incorrect type of context";
41  }
42  return parent_.placeInPath;
43  }
44 
46  if (type_ != Type::kStream) {
47  throw Exception(errors::LogicError) << "ParentContext::streamContext called for incorrect type of context";
48  }
49  return parent_.stream;
50  }
51 
53  if (type_ != Type::kGlobal) {
54  throw Exception(errors::LogicError) << "ParentContext::globalContext called for incorrect type of context";
55  }
56  return parent_.global;
57  }
58 
60  if (type_ != Type::kInternal) {
61  throw Exception(errors::LogicError) << "ParentContext::internalContext called for incorrect type of context";
62  }
63  return parent_.internal;
64  }
65 
67  switch (type_) {
68  case Type::kGlobal: {
70  }
71  case Type::kModule: {
73  }
74  case Type::kStream: {
76  }
77  case Type::kPlaceInPath: {
79  }
80  default:
81  break;
82  }
83  return false;
84  }
85 
86  std::ostream& operator<<(std::ostream& os, ParentContext const& pc) {
87  if (pc.type() == ParentContext::Type::kGlobal && pc.globalContext()) {
88  os << *pc.globalContext();
89  } else if (pc.type() == ParentContext::Type::kInternal && pc.internalContext()) {
90  os << *pc.internalContext();
91  } else if (pc.type() == ParentContext::Type::kModule && pc.moduleCallingContext()) {
92  os << *pc.moduleCallingContext();
93  } else if (pc.type() == ParentContext::Type::kPlaceInPath && pc.placeInPathContext()) {
94  os << *pc.placeInPathContext();
95  } else if (pc.type() == ParentContext::Type::kStream && pc.streamContext()) {
96  os << *pc.streamContext();
97  } else if (pc.type() == ParentContext::Type::kInvalid) {
98  os << "ParentContext invalid\n";
99  }
100  return os;
101  }
102 } // namespace edm
ModuleCallingContext.h
edm::ParentContext::streamContext
StreamContext const * streamContext() const
Definition: ParentContext.cc:45
edm::ParentContext::Parent::internal
InternalContext const * internal
Definition: ParentContext.h:53
edm::PathContext::streamContext
StreamContext const * streamContext() const
Definition: PathContext.h:31
edm::errors::LogicError
Definition: EDMException.h:37
PlaceInPathContext.h
edm
HLT enums.
Definition: AlignableModifier.h:19
cms::cuda::stream
uint32_t const T *__restrict__ const uint32_t *__restrict__ int32_t int Histo::index_type cudaStream_t stream
Definition: HistoContainer.h:51
edm::PlaceInPathContext::pathContext
PathContext const * pathContext() const
Definition: PlaceInPathContext.h:24
edm::ParentContext::Type::kStream
edm::ParentContext::Type::kGlobal
edm::ParentContext::Parent::module
ModuleCallingContext const * module
Definition: ParentContext.h:54
edm::ParentContext::Type::kPlaceInPath
edm::ParentContext::Parent::stream
StreamContext const * stream
Definition: ParentContext.h:56
edm::ParentContext::moduleCallingContext
ModuleCallingContext const * moduleCallingContext() const
Definition: ParentContext.cc:31
edm::ParentContext::ParentContext
ParentContext()
Definition: ParentContext.cc:15
edm::ParentContext::type
Type type() const
Definition: ParentContext.h:38
edm::ParentContext::placeInPathContext
PlaceInPathContext const * placeInPathContext() const
Definition: ParentContext.cc:38
edm::ModuleCallingContext::parent
ParentContext const & parent() const
Definition: ModuleCallingContext.h:53
edm::ParentContext::Parent::global
GlobalContext const * global
Definition: ParentContext.h:52
edm::operator<<
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
Definition: HLTGlobalStatus.h:106
EDMException.h
edm::StreamContext::isAtEndTransition
bool isAtEndTransition() const
Definition: StreamContext.h:56
edm::StreamContext
Definition: StreamContext.h:31
edm::ParentContext::Type
Type
Definition: ParentContext.h:29
edm::ParentContext::Type::kInternal
edm::InternalContext
Definition: InternalContext.h:23
edm::ParentContext::Type::kModule
edm::ParentContext
Definition: ParentContext.h:27
edm::GlobalContext
Definition: GlobalContext.h:29
GlobalContext.h
edm::ParentContext::internalContext
InternalContext const * internalContext() const
Definition: ParentContext.cc:59
InternalContext.h
edm::GlobalContext::isAtEndTransition
bool isAtEndTransition() const
Definition: GlobalContext.h:54
PathContext.h
callgraph.module
module
Definition: callgraph.py:61
edm::ParentContext::Parent::placeInPath
PlaceInPathContext const * placeInPath
Definition: ParentContext.h:55
ParentContext.h
edm::ParentContext::globalContext
GlobalContext const * globalContext() const
Definition: ParentContext.cc:52
Exception
Definition: hltDiff.cc:245
edm::ParentContext::Type::kInvalid
StreamContext.h
edm::PlaceInPathContext
Definition: PlaceInPathContext.h:19
edm::ParentContext::parent_
union edm::ParentContext::Parent parent_
edm::ParentContext::isAtEndTransition
bool isAtEndTransition() const
Definition: ParentContext.cc:66
edm::ParentContext::type_
Type type_
Definition: ParentContext.h:49
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29