LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ProcessConfiguration.cc
Go to the documentation of this file.
2 // vim: set sw=2 expandtab :
3 
4 #include "cetlib/MD5Digest.h"
6 
7 #include <ostream>
8 #include <tuple>
9 
10 using namespace std;
11 
12 namespace art {
13 
14  ProcessConfiguration::~ProcessConfiguration() = default;
15  ProcessConfiguration::ProcessConfiguration() noexcept = default;
16 
18  string const& procName,
19  fhicl::ParameterSetID const& pSetID,
20  ReleaseVersion const& relVersion) noexcept(false)
21  : processName_{procName}
22  , parameterSetID_{pSetID}
23  , releaseVersion_{relVersion}
24  {}
25 
26  ProcessConfiguration::ProcessConfiguration(
27  ProcessConfiguration const&) noexcept(false) = default;
28  ProcessConfiguration::ProcessConfiguration(ProcessConfiguration&&) = default;
29 
30  ProcessConfiguration& ProcessConfiguration::operator=(
31  ProcessConfiguration const& rhs) noexcept(false) = default;
32 
33  ProcessConfiguration& ProcessConfiguration::operator=(
34  ProcessConfiguration&& rhs) = default;
35 
36  string const&
37  ProcessConfiguration::processName() const noexcept
38  {
39  return processName_;
40  }
41 
43  ProcessConfiguration::parameterSetID() const noexcept
44  {
45  return parameterSetID_;
46  }
47 
48  ReleaseVersion const&
49  ProcessConfiguration::releaseVersion() const noexcept
50  {
51  return releaseVersion_;
52  }
53 
55  ProcessConfiguration::id() const
56  {
57  ostringstream oss;
58  oss << *this;
59  string stringrep = oss.str();
60  cet::MD5Digest md5alg(stringrep);
61  return ProcessConfigurationID(md5alg.digest().toString());
62  }
63 
64  bool
66  {
67  return !(a == b);
68  }
69 
70  bool
72  {
73  return std::tie(a.processName(), a.parameterSetID(), a.releaseVersion()) <
74  std::tie(b.processName(), b.parameterSetID(), b.releaseVersion());
75  }
76 
77  bool
79  {
80  return std::tie(a.processName(), a.parameterSetID(), a.releaseVersion()) ==
81  std::tie(b.processName(), b.parameterSetID(), b.releaseVersion());
82  }
83 
84  std::ostream&
85  operator<<(std::ostream& os, ProcessConfiguration const& pc)
86  {
87  os << pc.processName() << ' ' << pc.parameterSetID() << ' '
88  << pc.releaseVersion()
89  << ' '; // Retain the last space for backwards compatibility
90  return os;
91  }
92 
93 } // namespace art
ReleaseVersion const & releaseVersion() const noexcept
std::string ReleaseVersion
Definition: ReleaseVersion.h:7
bool operator!=(ProcessConfiguration const &a, ProcessConfiguration const &b)
STL namespace.
parameter set interface
std::ostream & operator<<(std::ostream &os, ProcessConfiguration const &pc)
Hash< ProcessConfigurationType > ProcessConfigurationID
Definition: MVAAlg.h:12
bool operator==(ProcessConfiguration const &a, ProcessConfiguration const &b)
std::string const & processName() const noexcept
fhicl::ParameterSetID const & parameterSetID() const noexcept
bool operator<(ProcessConfiguration const &a, ProcessConfiguration const &b)
Definition: Hash.h:34