CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DataFormats/Provenance/interface/ProcessConfiguration.h

Go to the documentation of this file.
00001 #ifndef DataFormats_Provenance_ProcessConfiguration_h
00002 #define DataFormats_Provenance_ProcessConfiguration_h
00003 
00004 #include "DataFormats/Provenance/interface/ParameterSetID.h"
00005 #include "DataFormats/Provenance/interface/PassID.h"
00006 #include "DataFormats/Provenance/interface/ProcessConfigurationID.h"
00007 #include "DataFormats/Provenance/interface/ReleaseVersion.h"
00008 
00009 #include <iosfwd>
00010 #include <string>
00011 
00012 namespace edm {
00013   class ProcessConfiguration {
00014   public:
00015     ProcessConfiguration();
00016     ProcessConfiguration(std::string const& procName,
00017                          ReleaseVersion const& relVersion,
00018                          PassID const& pass);
00019 
00020     ProcessConfiguration(std::string const& procName,
00021                          ParameterSetID const& pSetID,
00022                          ReleaseVersion const& relVersion,
00023                          PassID const& pass);
00024 
00025     std::string const& processName() const {return processName_;}
00026     ParameterSetID const& parameterSetID() const;
00027     bool isParameterSetValid() const {return parameterSetID_.isValid();}
00028     ReleaseVersion const& releaseVersion() const {return releaseVersion_;}
00029     PassID const& passID() const {return passID_;}
00030     ProcessConfigurationID id() const;
00031 
00032     void setParameterSetID(ParameterSetID const& pSetID);
00033 
00034     void reduce();
00035 
00036     void initializeTransients() const {transient_.reset();}
00037 
00038     struct Transients {
00039       Transients() : pcid_(), isCurrentProcess_(false) {}
00040       explicit Transients(bool current) : pcid_(), isCurrentProcess_(current) {}
00041       void reset() {
00042         pcid_.reset();
00043         isCurrentProcess_ = false;
00044       }
00045       ProcessConfigurationID pcid_;
00046       bool isCurrentProcess_;
00047     };
00048 
00049   private:
00050     ProcessConfigurationID& pcid() const {return transient_.pcid_;}
00051     bool& isCurrentProcess() const {return transient_.isCurrentProcess_;}
00052 
00053     std::string processName_;
00054     ParameterSetID parameterSetID_;
00055     ReleaseVersion releaseVersion_;
00056     PassID passID_;
00057     mutable Transients transient_;
00058   };
00059 
00060   bool
00061   operator<(ProcessConfiguration const& a, ProcessConfiguration const& b);
00062 
00063   inline
00064   bool
00065   operator==(ProcessConfiguration const& a, ProcessConfiguration const& b) {
00066     return a.processName() == b.processName() &&
00067     a.parameterSetID() == b.parameterSetID() &&
00068     a.releaseVersion() == b.releaseVersion() &&
00069     a.passID() == b.passID();
00070   }
00071 
00072   inline
00073   bool
00074   operator!=(ProcessConfiguration const& a, ProcessConfiguration const& b) {
00075     return !(a == b);
00076   }
00077 
00078   std::ostream&
00079   operator<<(std::ostream& os, ProcessConfiguration const& pc);
00080 }
00081 
00082 #endif