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);
50 
51  void setContext(State state, ParentContext const& parent, ModuleCallingContext const* previousOnThread);
52 
54 
56  State state() const { return state_; }
57  Type type() const { return parent_.type(); }
62  std::uintptr_t callID() const { return id_; }
63  ParentContext const& parent() const { 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;
74  GlobalContext const* getGlobalContext() const;
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;
84 
86 
87  private:
91  std::uintptr_t id_;
93  };
94 
96  std::ostream& operator<<(std::ostream&, ModuleCallingContext const&);
97 } // namespace edm
98 #endif
ModuleCallingContext const * previousModuleOnThread() const
InternalContext const * internalContext() const
ModuleDescription const * moduleDescription() const
void exceptionContext(cms::Exception &, ESModuleCallingContext const &)
Type type() const
Definition: ParentContext.h:38
ModuleDescription const * moduleDescription_
GlobalContext const * globalContext() const
InternalContext const * internalContext() const
void setContext(State state, ParentContext const &parent, ModuleCallingContext const *previousOnThread)
ModuleCallingContext const * getTopModuleCallingContext() const
StreamContext const * streamContext() const
PlaceInPathContext const * placeInPathContext() const
StreamContext const * streamContext() const
std::uintptr_t callID() const
ModuleCallingContext const * moduleCallingContext() const
Namespace of DDCMS conversion namespace.
ModuleCallingContext const * moduleCallingContext() const
GlobalContext const * globalContext() const
PlaceInPathContext const * placeInPathContext() const
HLT enums.
StreamContext const * getStreamContext() const
ModuleCallingContext(ModuleDescription const *moduleDescription)
ModuleCallingContext const * previousModuleOnThread_
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger table.
GlobalContext const * getGlobalContext() const
ParentContext const & parent() const