CMS 3D CMS Logo

ModuleCallingContext.h
Go to the documentation of this file.
1 #ifndef FWCore_ServiceRegistry_ModuleCallingContext_h
2 #define FWCore_ServiceRegistry_ModuleCallingContext_h
3 
13 //
14 // Original Author: W. David Dagenhart
15 // Created: 7/11/2013
16 
18 
19 #include <iosfwd>
20 #include <cstdint>
21 
22 namespace cms {
23  class Exception;
24 }
25 namespace edm {
26 
27  class GlobalContext;
28  class InternalContext;
29  class ModuleDescription;
30  class PlaceInPathContext;
31  class StreamContext;
32 
34  public:
36 
37  enum class State {
38  kPrefetching, // prefetching products before starting to run
39  kRunning, // module actually running
40  kInvalid
41  };
42 
44 
46  std::uintptr_t id,
47  State state,
48  ParentContext const& parent,
49  ModuleCallingContext const* previousOnThread) noexcept;
50 
51  void setContext(State state, ParentContext const& parent, ModuleCallingContext const* previousOnThread) noexcept;
52 
53  void setState(State state) noexcept { state_ = state; }
54 
56  State state() const noexcept { return state_; }
57  Type type() const noexcept { return parent_.type(); }
62  std::uintptr_t callID() const noexcept { return id_; }
63  ParentContext const& parent() const noexcept { return parent_; }
66  StreamContext const* streamContext() const { return parent_.streamContext(); }
67  GlobalContext const* globalContext() const { return parent_.globalContext(); }
69 
70  // These functions will iterate up a series of linked context objects
71  // to find the StreamContext or GlobalContext at the top of the series.
72  // Throws if the top context object does not have that type.
73  StreamContext const* getStreamContext() const noexcept(false);
75 
76  // This function will iterate up a series of linked context objects to
77  // find the highest level ModuleCallingContext. It will often return a
78  // pointer to itself.
80 
81  // Returns the number of ModuleCallingContexts above this ModuleCallingContext
82  // in the series of linked context objects.
83  unsigned depth() const noexcept;
84 
86 
87  private:
91  std::uintptr_t id_;
93  };
94 
96  std::ostream& operator<<(std::ostream&, ModuleCallingContext const&);
97 } // namespace edm
98 #endif
PlaceInPathContext const * placeInPathContext() const noexcept(false)
void setContext(State state, ParentContext const &parent, ModuleCallingContext const *previousOnThread) noexcept
InternalContext const * internalContext() const noexcept(false)
StreamContext const * streamContext() const noexcept(false)
void exceptionContext(cms::Exception &, ESModuleCallingContext const &)
ModuleDescription const * moduleDescription_
ModuleCallingContext const * previousModuleOnThread() const noexcept
Type type() const noexcept
InternalContext const * internalContext() const
GlobalContext const * globalContext() const noexcept(false)
ModuleCallingContext const * moduleCallingContext() const noexcept(false)
void setState(State state) noexcept
ModuleDescription const * moduleDescription() const noexcept
Type type() const noexcept
Definition: ParentContext.h:38
PlaceInPathContext const * placeInPathContext() const
StreamContext const * streamContext() const
GlobalContext const * getGlobalContext() const noexcept(false)
ModuleCallingContext const * getTopModuleCallingContext() const noexcept
unsigned depth() const noexcept
std::uintptr_t callID() const noexcept
Namespace of DDCMS conversion namespace.
StreamContext const * getStreamContext() const noexcept(false)
ModuleCallingContext(ModuleDescription const *moduleDescription) noexcept
ParentContext const & parent() const noexcept
ModuleCallingContext const * moduleCallingContext() const
GlobalContext const * globalContext() const
State state() const noexcept
HLT enums.
ModuleCallingContext const * previousModuleOnThread_
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger table.