|
Celeritas 0.7.0-9+develop.0ac2b625d
|
Simple version comparison. More...
#include <Version.hh>
Public Types | |
Type aliases | |
| using | size_type = unsigned int |
| using | ArrayT = std::array< size_type, 3 > |
Public Member Functions | |
| constexpr | Version (size_type major, size_type minor=0, size_type patch=0) |
| Construct from x.y.z integers. | |
| constexpr | Version () |
| Default (false) version. | |
Accessors | |
| constexpr ArrayT const & | value () const |
| Get version as an array. | |
| constexpr size_type | major () const |
| Get major version. | |
| constexpr size_type | minor () const |
| Get minor version. | |
| constexpr size_type | patch () const |
| Get patch version. | |
| constexpr | operator bool () const |
| Whether the version is defined. | |
Static Public Member Functions | |
| static Version | from_string (std::string_view sv) |
| Construct from a string "1.2.3". | |
| static Version | from_package (std::string_view p) |
| Construct from a Celeritas-configured package name "vecgeom"/"VecGeom". | |
| static constexpr Version | from_hex_xxyyzz (size_type value) |
| Construct from an 0xXXYYZZ integer. | |
| static constexpr Version | from_dec_xyz (size_type value) |
| Construct from a decimal with XYZ or XXYZ. | |
Friends | |
| bool | operator== (Version const &lhs, Version const &rhs) |
| bool | operator!= (Version const &lhs, Version const &rhs) |
| bool | operator< (Version const &lhs, Version const &rhs) |
| bool | operator> (Version const &lhs, Version const &rhs) |
| bool | operator<= (Version const &lhs, Version const &rhs) |
| bool | operator>= (Version const &lhs, Version const &rhs) |
| std::ostream & | operator<< (std::ostream &, Version const &) |
| Write to a stream. | |
Simple version comparison.
This is intended to be constructed with version numbers from celeritas_cmake_strings.hh and used in unit tests. It can be used in if constexpr expressions with preprocessor macros. In the constructor documentation, x/y/z correspond to major/minor/patch.
Versions evaluate to false with the default constructor or when constructed from a Celeritas package that is disabled.
With Geant4 enabled, these should all produce the same Version object:
but note that:
corecel/Config.hh)Construct from a decimal with XYZ or XXYZ.
This version scheme is used by Geant4.
Construct from an 0xXXYYZZ integer.
This version scheme is used by Celeritas. (The leading 0x prevents version 01 from turning the expression into an octal.)
|
static |
Construct from a Celeritas-configured package name "vecgeom"/"VecGeom".
false version.
|
static |
Construct from a string "1.2.3".
Ignore prerelease and build metadata suffixes introduced by '-' or '+'. Empty strings will raise a RuntimeError.