Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ActsVersion.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ActsVersion.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2023 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include "Acts/ActsVersion.hpp"
10 
11 #include <ostream>
12 #include <string_view>
13 
14 namespace Acts {
15 
16 VersionInfo::VersionInfo(unsigned int majorIn, unsigned int minorIn,
17  unsigned int patchIn, const char* const commitHashIn)
18  : versionMajor(majorIn),
19  versionMinor(minorIn),
20  versionPatch(patchIn),
21  commitHash(commitHashIn) {}
22 
23 VersionInfo VersionInfo::fromLibrary() {
24  // this is filled by the Core shared library
25  // while the constants below depend on the include
26  return VersionInfo{VersionMajor, VersionMinor, VersionPatch, CommitHash};
27 }
28 
29 bool VersionInfo::operator==(const VersionInfo& other) const {
30  return versionMajor == other.versionMajor &&
31  versionMinor == other.versionMinor &&
32  versionPatch == other.versionPatch &&
33  std::string_view{commitHash} == std::string_view{other.commitHash};
34 }
35 
36 std::ostream& operator<<(std::ostream& os, const VersionInfo& vi) {
37  os << vi.versionMajor << "." << vi.versionMinor << "." << vi.versionPatch
38  << " (commit " << vi.commitHash << ")";
39  return os;
40 }
41 } // namespace Acts