Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-11 03:34:17

0001 #ifndef FWCore_ServiceRegistry_ParentContext_h
0002 #define FWCore_ServiceRegistry_ParentContext_h
0003 
0004 /**\class edm::ParentContext
0005 
0006  Description: This is intended to be used as a member
0007 of ModuleCallingContext.
0008 
0009  Usage:
0010 
0011 
0012 */
0013 //
0014 // Original Author: W. David Dagenhart
0015 //         Created: 7/11/2013
0016 
0017 #include <iosfwd>
0018 
0019 namespace edm {
0020 
0021   class GlobalContext;
0022   class InternalContext;
0023   class ModuleCallingContext;
0024   class PlaceInPathContext;
0025   class StreamContext;
0026 
0027   class ParentContext {
0028   public:
0029     enum class Type { kGlobal, kInternal, kModule, kPlaceInPath, kStream, kInvalid };
0030 
0031     ParentContext() noexcept;
0032     ParentContext(GlobalContext const*) noexcept;
0033     ParentContext(InternalContext const*) noexcept;
0034     ParentContext(ModuleCallingContext const*) noexcept;
0035     ParentContext(PlaceInPathContext const*) noexcept;
0036     ParentContext(StreamContext const*) noexcept;
0037 
0038     [[nodiscard]] Type type() const noexcept { return type_; }
0039 
0040     bool isAtEndTransition() const noexcept;
0041 
0042     GlobalContext const* globalContext() const noexcept(false);
0043     InternalContext const* internalContext() const noexcept(false);
0044     ModuleCallingContext const* moduleCallingContext() const noexcept(false);
0045     PlaceInPathContext const* placeInPathContext() const noexcept(false);
0046     StreamContext const* streamContext() const noexcept(false);
0047 
0048   private:
0049     Type type_;
0050 
0051     union Parent {
0052       GlobalContext const* global;
0053       InternalContext const* internal;
0054       ModuleCallingContext const* module;
0055       PlaceInPathContext const* placeInPath;
0056       StreamContext const* stream;
0057     } parent_;
0058   };
0059 
0060   std::ostream& operator<<(std::ostream&, ParentContext const&);
0061 }  // namespace edm
0062 #endif