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 
21 namespace edm {
22 
23  class GlobalContext;
24  class InternalContext;
25  class ModuleDescription;
26  class PlaceInPathContext;
27  class StreamContext;
28 
30  public:
32 
33  enum class State {
34  kPrefetching, // prefetching products before starting to run
35  kRunning, // module actually running
36  kInvalid
37  };
38 
40 
41  ModuleCallingContext(ModuleDescription const* moduleDescription,
42  State state,
43  ParentContext const& parent,
44  ModuleCallingContext const* previousOnThread);
45 
46  void setContext(State state, ParentContext const& parent, ModuleCallingContext const* previousOnThread);
47 
48  void setState(State state) { state_ = state; }
49 
51  State state() const { return state_; }
52  Type type() const { return parent_.type(); }
53  ParentContext const& parent() const { return parent_; }
56  StreamContext const* streamContext() const { return parent_.streamContext(); }
57  GlobalContext const* globalContext() const { return parent_.globalContext(); }
59 
60  // These functions will iterate up a series of linked context objects
61  // to find the StreamContext or GlobalContext at the top of the series.
62  // Throws if the top context object does not have that type.
63  StreamContext const* getStreamContext() const;
64  GlobalContext const* getGlobalContext() const;
65 
66  // This function will iterate up a series of linked context objects to
67  // find the highest level ModuleCallingContext. It will often return a
68  // pointer to itself.
70 
71  // Returns the number of ModuleCallingContexts above this ModuleCallingContext
72  // in the series of linked context objects.
73  unsigned depth() const;
74 
76 
77  private:
82  };
83 
84  std::ostream& operator<<(std::ostream&, ModuleCallingContext const&);
85 } // namespace edm
86 #endif
Type type() const
Definition: ParentContext.h:38
GlobalContext const * globalContext() const
StreamContext const * getStreamContext() const
ModuleCallingContext const * moduleCallingContext() const
ModuleCallingContext const * getTopModuleCallingContext() const
ModuleDescription const * moduleDescription_
InternalContext const * internalContext() const
ModuleCallingContext const * moduleCallingContext() const
void setContext(State state, ParentContext const &parent, ModuleCallingContext const *previousOnThread)
PlaceInPathContext const * placeInPathContext() const
ParentContext const & parent() const
ModuleDescription const * moduleDescription() const
InternalContext const * internalContext() const
StreamContext const * streamContext() const
StreamContext const * streamContext() const
ModuleCallingContext const * previousModuleOnThread() const
HLT enums.
ModuleCallingContext(ModuleDescription const *moduleDescription)
GlobalContext const * getGlobalContext() const
ModuleCallingContext const * previousModuleOnThread_
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
GlobalContext const * globalContext() const
PlaceInPathContext const * placeInPathContext() const