Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
version.hpp
Go to the documentation of this file.
1// Copyright 2024, Toyota Motor Corporation
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_VERSION_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_VERSION_HPP_
7
8#include "arene/base/detail/raw_c_string.hpp"
9// parasoft-end-suppress AUTOSAR-A16_2_2-a-2
10
11#include "arene/base/stdlib_choice/cstdint.hpp"
12
13// AUTOSAR exceptions:
14// A16-0-1 The pre-processor shall only be used for unconditional and
15// conditional file inclusion and include guards, and using the following
16// directives: (1) #ifndef, (2) #ifdef, (3) #if, (4) #if defined, (5) #elif, (6)
17// #else, (7) #define, (8) #endif, (9) #include.
18//
19// Exception Rationale: The code below is used to make user-configurable parts
20// of a library that can be used by everyone. It increases safety, as documented
21// in "docs/source/implementation/macros_and_configuration.md" and prevents
22// excessive, convoluted if-elif definition chains that have resulted in the
23// wrong code being included or used in the past. These utilities also offer
24// safer ways of checking for the existence of certain macros required for
25// interfacing with the C++ standard.
26
27// NOLINTBEGIN(cppcoreguidelines-macro-usage)
28
29//////
30
31// parasoft-begin-suppress AUTOSAR-A16_0_1-d-2 "Macros for the ABI namespace"
32#define ARENE_BASE_INLINE_ABI_NAMESPACE_OPEN_I_ inline namespace v0 {
33#define ARENE_BASE_INLINE_ABI_NAMESPACE_CLOSE_I_ }
34// parasoft-end-suppress AUTOSAR-A16_0_1-d-2
35
36// clang-format on
37
38namespace arene {
39namespace base {
41
42//////
43/// @brief The major version for Arene.Base.
44constexpr std::uint32_t version_major{0U};
45
46//////
47/// @brief The minor version for Arene.Base.
48constexpr std::uint32_t version_minor{0U};
49//////
50/// @brief The patch version for Arene.Base.
51constexpr std::uint32_t version_patch{0U};
52//////
53/// @brief The version of Arene.Base as a string.
54// parasoft-begin-suppress AUTOSAR-A27_0_4-d "'const char *' value constructed from string literal always has the
55// correct buffer size and a static lifetime"
56// NOLINTNEXTLINE(clang-diagnostic-unused-const-variable)
58// parasoft-end-suppress AUTOSAR-A27_0_4-d
59
60namespace version_detail {
61/// @brief The scale factor to use when combining the major version number into @c version
62constexpr std::uint32_t major_scale{1'000'000U};
63/// @brief The scale factor to use when combining the minor version number into @c version
64constexpr std::uint32_t minor_scale{1'000U};
65} // namespace version_detail
66
67//////
68/// @brief The version of Arene.Base.
69///
70/// @remarks Each 100's grouping (in decimal) a part of the version number. For
71/// example, a value of @c 5'021'001 is a major version of @c 5 , a minor
72/// version of @c 21 , and a patch version of @c 1.
73//////
74// NOLINTNEXTLINE(clang-diagnostic-unused-const-variable)
75constexpr std::uint32_t version{
76 ((version_major * version_detail::major_scale) + (version_minor * version_detail::minor_scale) + (version_patch))
77};
78
80} // namespace base
81} // namespace arene
82
83// NOLINTEND(cppcoreguidelines-macro-usage)
84
85#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_VERSION_HPP_
Definition array_exceptions_disabled.cpp:11
ARENE_BASE_INLINE_ABI_NAMESPACE_OPEN_I_ constexpr std::uint32_t version_major
The major version for Arene.Base.
Definition version.hpp:44
constexpr std::uint32_t version_minor
The minor version for Arene.Base.
Definition version.hpp:48
constexpr std::uint32_t version_patch
The patch version for Arene.Base.
Definition version.hpp:51
constexpr detail::raw_c_string version_string
The version of Arene.Base as a string.
Definition version.hpp:57
constexpr std::uint32_t version
The version of Arene.Base.
Definition version.hpp:75
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10
#define ARENE_BASE_INLINE_ABI_NAMESPACE_CLOSE_I_
Definition version.hpp:33
#define ARENE_BASE_INLINE_ABI_NAMESPACE_OPEN_I_
Definition version.hpp:32