Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
quantity_unit.hpp
Go to the documentation of this file.
1// Copyright 2026, Toyota Motor Corporation
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UNITS_QUANTITY_UNIT_HPP_
5#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UNITS_QUANTITY_UNIT_HPP_
6
7#include "arene/base/constraints/constraints.hpp"
8#include "arene/base/stdlib_choice/enable_if.hpp"
9#include "arene/base/units/detail/missing.hpp"
10#include "arene/base/units/is_possible_unit_for.hpp"
11#include "arene/base/units/quantity_kind.hpp"
12
13namespace arene {
14namespace base {
15
16namespace quantity_unit_detail {
17
18/// @brief implementation class for a quantity kind with a rebound unit
19/// @tparam Kind quantity kind to rebind
20/// @tparam Unit the unit type to rebind with
21template <typename Kind, typename Unit>
22class quantity_kind_with_rebound_unit
23 : public quantity_kind<quantity_kind_with_rebound_unit<Kind, Unit>, Kind, Unit> {};
24
25} // namespace quantity_unit_detail
26
27/// @brief Base class for declaring a quantity unit
28/// @tparam Tag the derived class which represents the quantity unit
29/// @tparam Kind The quantity kind for which this is a unit
30///
31/// @pre @c Tag must derive from @c quantity_unit<Tag>
32template <typename Tag, typename Kind>
35 // parasoft-begin-suppress AUTOSAR-A11_3_1-a-2 "Use of friend permitted for hidden friend idiom by A11-3-1 Permit #2
36 // v1.0.0"
37 //
38 // parasoft-begin-suppress AUTOSAR-M3_3_2-a "False positive: cannot apply static to a hidden friend function"
39 // parasoft-begin-suppress CERT_C-EXP37-a-3 "False positive: rule does not mention naming all parameters"
40
41 /// @brief helper used to rebind the unit type of a quantity kind
42 /// @tparam OtherDerived derived quantity kind type to rebind
43 /// @tparam OtherParentKind parent kind of the quantity type to rebind
44 /// @tparam OtherUnit unit of the quantity type to rebind
45 /// @return different quantity kind with the unit specified to be @c Tag
46 /// @note Requires @c is_possible_unit_for<Tag, OtherDerived> to be @c true
47 template <
48 typename OtherDerived,
49 typename OtherParentKind,
50 typename OtherOrigin,
51 typename OtherUnit,
53 friend auto
58
59 // parasoft-end-suppress AUTOSAR-A11_3_1-a-2
60 // parasoft-end-suppress AUTOSAR-M3_3_2-a
61 // parasoft-end-suppress CERT_C-EXP37-a-3
62
63 public:
64 /// @brief Type alias to indicate the quantity kind for which this is a unit
66};
67
68} // namespace base
69} // namespace arene
70
71#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UNITS_QUANTITY_UNIT_HPP_
Base class for declaring a quantity unit.
Definition quantity_unit.hpp:34
Definition array_exceptions_disabled.cpp:11
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10