Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:29:07

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();
0032     ParentContext(GlobalContext const*);
0033     ParentContext(InternalContext const*);
0034     ParentContext(ModuleCallingContext const*);
0035     ParentContext(PlaceInPathContext const*);
0036     ParentContext(StreamContext const*);
0037 
0038     Type type() const { return type_; }
0039 
0040     bool isAtEndTransition() const;
0041 
0042     GlobalContext const* globalContext() const;
0043     InternalContext const* internalContext() const;
0044     ModuleCallingContext const* moduleCallingContext() const;
0045     PlaceInPathContext const* placeInPathContext() const;
0046     StreamContext const* streamContext() const;
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