Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:13:02

0001 #ifndef FWCore_ServiceRegistry_ProcessContext_h
0002 #define FWCore_ServiceRegistry_ProcessContext_h
0003 
0004 /**\class edm::ProcessContext
0005 
0006  Description: Holds pointer to ProcessConfiguration and
0007 if this is a SubProcess also a pointer to the parent
0008 ProcessContext. This is intended primarily to be passed
0009 to Services as an argument to their callback functions.
0010 
0011  Usage:
0012 
0013 
0014 */
0015 //
0016 // Original Author: W. David Dagenhart
0017 //         Created: 7/2/2013
0018 
0019 #include "DataFormats/Provenance/interface/ParameterSetID.h"
0020 #include "DataFormats/Provenance/interface/ProcessConfiguration.h"
0021 
0022 #include <iosfwd>
0023 #include <string>
0024 
0025 namespace edm {
0026 
0027   class ProcessContext {
0028   public:
0029     ProcessContext();
0030 
0031     std::string const& processName() const { return processConfiguration_->processName(); }
0032     ParameterSetID const& parameterSetID() const { return processConfiguration_->parameterSetID(); }
0033     ProcessConfiguration const* processConfiguration() const { return processConfiguration_; }
0034     bool isSubProcess() const { return parentProcessContext_ != nullptr; }
0035     ProcessContext const& parentProcessContext() const;
0036 
0037     void setProcessConfiguration(ProcessConfiguration const* processConfiguration);
0038     void setParentProcessContext(ProcessContext const* parentProcessContext);
0039 
0040   private:
0041     ProcessConfiguration const* processConfiguration_;
0042 
0043     // If this is a SubProcess this points to the parent process,
0044     // otherwise it is null.
0045     ProcessContext const* parentProcessContext_;
0046   };
0047 
0048   std::ostream& operator<<(std::ostream&, ProcessContext const&);
0049 }  // namespace edm
0050 #endif