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 
42  State state,
43  ParentContext const& parent,
44  ModuleCallingContext const* previousOnThread);
45 
46  void setContext(State state, ParentContext const& parent, ModuleCallingContext const* previousOnThread);
47 
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
edm::ModuleCallingContext::state
State state() const
Definition: ModuleCallingContext.h:51
edm::ModuleCallingContext::parent_
ParentContext parent_
Definition: ModuleCallingContext.h:80
edm::ParentContext::streamContext
StreamContext const * streamContext() const
Definition: ParentContext.cc:45
edm::ModuleCallingContext::State::kPrefetching
edm::ModuleCallingContext::moduleDescription_
ModuleDescription const * moduleDescription_
Definition: ModuleCallingContext.h:79
edm::ModuleCallingContext::State
State
Definition: ModuleCallingContext.h:33
edm::ModuleCallingContext::placeInPathContext
PlaceInPathContext const * placeInPathContext() const
Definition: ModuleCallingContext.h:55
edm::ModuleCallingContext::globalContext
GlobalContext const * globalContext() const
Definition: ModuleCallingContext.h:57
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ModuleCallingContext::streamContext
StreamContext const * streamContext() const
Definition: ModuleCallingContext.h:56
edm::ModuleCallingContext::type
Type type() const
Definition: ModuleCallingContext.h:52
edm::ModuleCallingContext::State::kInvalid
edm::ModuleCallingContext::moduleDescription
ModuleDescription const * moduleDescription() const
Definition: ModuleCallingContext.h:50
edm::ParentContext::moduleCallingContext
ModuleCallingContext const * moduleCallingContext() const
Definition: ParentContext.cc:31
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::ModuleDescription
Definition: ModuleDescription.h:21
edm::ModuleCallingContext::moduleCallingContext
ModuleCallingContext const * moduleCallingContext() const
Definition: ModuleCallingContext.h:54
edm::operator<<
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
Definition: HLTGlobalStatus.h:106
edm::StreamContext
Definition: StreamContext.h:31
edm::ModuleCallingContext::internalContext
InternalContext const * internalContext() const
Definition: ModuleCallingContext.h:58
edm::ParentContext::Type
Type
Definition: ParentContext.h:29
edm::InternalContext
Definition: InternalContext.h:23
edm::ModuleCallingContext::depth
unsigned depth() const
Definition: ModuleCallingContext.cc:66
edm::ParentContext
Definition: ParentContext.h:27
edm::ModuleCallingContext::previousModuleOnThread_
ModuleCallingContext const * previousModuleOnThread_
Definition: ModuleCallingContext.h:78
edm::GlobalContext
Definition: GlobalContext.h:29
edm::ModuleCallingContext::previousModuleOnThread
ModuleCallingContext const * previousModuleOnThread() const
Definition: ModuleCallingContext.h:75
edm::ModuleCallingContext::getStreamContext
StreamContext const * getStreamContext() const
Definition: ModuleCallingContext.cc:32
edm::ModuleCallingContext::setState
void setState(State state)
Definition: ModuleCallingContext.h:48
State
State
Definition: RPixErrorChecker.h:15
edm::ModuleCallingContext::setContext
void setContext(State state, ParentContext const &parent, ModuleCallingContext const *previousOnThread)
Definition: ModuleCallingContext.cc:24
edm::ParentContext::internalContext
InternalContext const * internalContext() const
Definition: ParentContext.cc:59
edm::ModuleCallingContext::Type
ParentContext::Type Type
Definition: ModuleCallingContext.h:31
edm::ModuleCallingContext::getGlobalContext
GlobalContext const * getGlobalContext() const
Definition: ModuleCallingContext.cc:43
edm::ModuleCallingContext::getTopModuleCallingContext
ModuleCallingContext const * getTopModuleCallingContext() const
Definition: ModuleCallingContext.cc:52
ParentContext.h
edm::ModuleCallingContext::state_
State state_
Definition: ModuleCallingContext.h:81
edm::ParentContext::globalContext
GlobalContext const * globalContext() const
Definition: ParentContext.cc:52
edm::ModuleCallingContext::ModuleCallingContext
ModuleCallingContext(ModuleDescription const *moduleDescription)
Definition: ModuleCallingContext.cc:12
edm::PlaceInPathContext
Definition: PlaceInPathContext.h:19
edm::ModuleCallingContext::State::kRunning
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29