File indexing completed on 2024-04-06 12:05:02
0001 #ifndef DataFormats_Provenance_ProcessConfiguration_h
0002 #define DataFormats_Provenance_ProcessConfiguration_h
0003
0004 #include "DataFormats/Provenance/interface/ParameterSetID.h"
0005 #include "DataFormats/Provenance/interface/PassID.h"
0006 #include "DataFormats/Provenance/interface/ProcessConfigurationID.h"
0007 #include "DataFormats/Provenance/interface/ReleaseVersion.h"
0008
0009 #include <iosfwd>
0010 #include <string>
0011 #include <vector>
0012
0013 namespace edm {
0014 class ProcessConfiguration {
0015 public:
0016 ProcessConfiguration();
0017 ProcessConfiguration(std::string const& procName, ReleaseVersion const& relVersion, PassID const& pass);
0018
0019 ProcessConfiguration(std::string const& procName,
0020 ParameterSetID const& pSetID,
0021 ReleaseVersion const& relVersion,
0022 PassID const& pass);
0023
0024 std::string const& processName() const { return processName_; }
0025 ParameterSetID const& parameterSetID() const;
0026 bool isParameterSetValid() const { return parameterSetID_.isValid(); }
0027 ReleaseVersion const& releaseVersion() const { return releaseVersion_; }
0028 PassID const& passID() const { return passID_; }
0029 ProcessConfigurationID id() const;
0030
0031 void setParameterSetID(ParameterSetID const& pSetID);
0032
0033 ProcessConfigurationID setProcessConfigurationID();
0034
0035 void reduce();
0036
0037 void initializeTransients() { transient_.reset(); }
0038
0039 struct Transients {
0040 Transients() : pcid_(), isCurrentProcess_(false) {}
0041 explicit Transients(bool current) : pcid_(), isCurrentProcess_(current) {}
0042 void reset() {
0043 pcid_.reset();
0044 isCurrentProcess_ = false;
0045 }
0046 ProcessConfigurationID pcid_;
0047 bool isCurrentProcess_;
0048 };
0049
0050 private:
0051 void setPCID(ProcessConfigurationID const& pcid) { transient_.pcid_ = pcid; }
0052 bool isCurrentProcess() const { return transient_.isCurrentProcess_; }
0053 void setCurrentProcess() { transient_.isCurrentProcess_ = true; }
0054
0055 std::string processName_;
0056 ParameterSetID parameterSetID_;
0057 ReleaseVersion releaseVersion_;
0058 PassID passID_;
0059 Transients transient_;
0060 };
0061
0062 typedef std::vector<ProcessConfiguration> ProcessConfigurationVector;
0063
0064 bool operator<(ProcessConfiguration const& a, ProcessConfiguration const& b);
0065
0066 inline bool operator==(ProcessConfiguration const& a, ProcessConfiguration const& b) {
0067 return a.processName() == b.processName() && a.parameterSetID() == b.parameterSetID() &&
0068 a.releaseVersion() == b.releaseVersion() && a.passID() == b.passID();
0069 }
0070
0071 inline bool operator!=(ProcessConfiguration const& a, ProcessConfiguration const& b) { return !(a == b); }
0072
0073 std::ostream& operator<<(std::ostream& os, ProcessConfiguration const& pc);
0074 }
0075
0076 #endif