CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 cms {
22  class Exception;
23 }
24 namespace edm {
25 
26  class GlobalContext;
27  class InternalContext;
28  class ModuleDescription;
29  class PlaceInPathContext;
30  class StreamContext;
31 
33  public:
35 
36  enum class State {
37  kPrefetching, // prefetching products before starting to run
38  kRunning, // module actually running
39  kInvalid
40  };
41 
43 
45  State state,
46  ParentContext const& parent,
47  ModuleCallingContext const* previousOnThread);
48 
49  void setContext(State state, ParentContext const& parent, ModuleCallingContext const* previousOnThread);
50 
52 
54  State state() const { return state_; }
55  Type type() const { return parent_.type(); }
56  ParentContext const& parent() const { return parent_; }
59  StreamContext const* streamContext() const { return parent_.streamContext(); }
60  GlobalContext const* globalContext() const { return parent_.globalContext(); }
62 
63  // These functions will iterate up a series of linked context objects
64  // to find the StreamContext or GlobalContext at the top of the series.
65  // Throws if the top context object does not have that type.
66  StreamContext const* getStreamContext() const;
67  GlobalContext const* getGlobalContext() const;
68 
69  // This function will iterate up a series of linked context objects to
70  // find the highest level ModuleCallingContext. It will often return a
71  // pointer to itself.
73 
74  // Returns the number of ModuleCallingContexts above this ModuleCallingContext
75  // in the series of linked context objects.
76  unsigned depth() const;
77 
79 
80  private:
85  };
86 
88  std::ostream& operator<<(std::ostream&, ModuleCallingContext const&);
89 } // namespace edm
90 #endif
Type type() const
Definition: ParentContext.h:38
GlobalContext const * globalContext() const
void exceptionContext(cms::Exception &, ESModuleCallingContext 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
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