FairMQ  1.4.33
C++ Message Queuing Library and Framework
Version.h
1 /********************************************************************************
2  * Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 
9 #ifndef FAIR_MQ_TOOLS_VERSION_H
10 #define FAIR_MQ_TOOLS_VERSION_H
11 
12 #include <ostream>
13 #include <tuple>
14 
15 namespace fair::mq::tools
16 {
17 
18 struct Version
19 {
20  const int fkMajor, fkMinor, fkPatch;
21 
22  friend auto operator< (const Version& lhs, const Version& rhs) -> bool { return std::tie(lhs.fkMajor, lhs.fkMinor, lhs.fkPatch) < std::tie(rhs.fkMajor, rhs.fkMinor, rhs.fkPatch); }
23  friend auto operator> (const Version& lhs, const Version& rhs) -> bool { return rhs < lhs; }
24  friend auto operator<=(const Version& lhs, const Version& rhs) -> bool { return !(lhs > rhs); }
25  friend auto operator>=(const Version& lhs, const Version& rhs) -> bool { return !(lhs < rhs); }
26  friend auto operator==(const Version& lhs, const Version& rhs) -> bool { return std::tie(lhs.fkMajor, lhs.fkMinor, lhs.fkPatch) == std::tie(rhs.fkMajor, rhs.fkMinor, rhs.fkPatch); }
27  friend auto operator!=(const Version& lhs, const Version& rhs) -> bool { return !(lhs == rhs); }
28  friend auto operator<<(std::ostream& os, const Version& v) -> std::ostream& { return os << v.fkMajor << "." << v.fkMinor << "." << v.fkPatch; }
29 };
30 
31 } // namespace fair::mq::tools
32 
33 #endif /* FAIR_MQ_TOOLS_VERSION_H */
fair::mq::tools::Version
Definition: Version.h:25

privacy