Celeritas  0.5.0-56+6b053cd
Public Member Functions | Static Public Member Functions | List of all members
celeritas::Version Class Reference

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.
 
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.
 

Static Public Member Functions

static Version from_string (std::string_view sv)
 Construct from a string "1.2.3".
 
static constexpr Version from_hex_xxyyzz (size_type value)
 Construct from an 0xXXYYZZ integer. More...
 
static constexpr Version from_dec_xyz (size_type value)
 Construct from a decimal with XYZ or XXYZ. More...
 

Detailed Description

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.

Version(4) == Version(4.0) == Version(4.0.0)
Version(3.1) > Version(3)
constexpr Version(size_type major, size_type minor=0, size_type patch=0)
Construct from x.y.z integers.
Definition: src/corecel/sys/Version.hh:114

Member Function Documentation

◆ from_dec_xyz()

constexpr Version celeritas::Version::from_dec_xyz ( size_type  value)
inlinestaticconstexpr

Construct from a decimal with XYZ or XXYZ.

This version scheme is used by Geant4.

◆ from_hex_xxyyzz()

constexpr Version celeritas::Version::from_hex_xxyyzz ( size_type  value)
inlinestaticconstexpr

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.)


The documentation for this class was generated from the following files: