Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
unit_kind.hpp
Go to the documentation of this file.
1// parasoft-begin-suppress AUTOSAR-A2_8_1-a "The helper class is an implementation detail of unit_kind_t"
2// Copyright 2026, Toyota Motor Corporation
3//
4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UNITS_UNIT_KIND_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UNITS_UNIT_KIND_HPP_
7
8#include "arene/base/constraints/constraints.hpp"
9#include "arene/base/stdlib_choice/enable_if.hpp"
10#include "arene/base/units/is_unit.hpp"
11
12namespace arene {
13namespace base {
14
15namespace unit_kind_detail {
16
17/// @brief Helper template for finding the underlying quantity kind for a unit
18/// @tparam Unit The unit to get the quantity kind for
19template <typename Unit, typename = constraints<>>
20class unit_kind_helper {
21 public:
22 /// @brief The quantity kind for the unit
23 using type = typename Unit::unit_kind_type;
24};
25
26/// @brief Helper template for finding the underlying quantity kind for a unit
27/// @tparam Unit The unit to get the quantity kind for
28template <typename Unit>
29class unit_kind_helper<Unit, constraints<std::enable_if_t<is_unit_v<typename Unit::unit_kind_type>>>> {
30 public:
31 /// @brief The quantity kind for the unit
32 using type = typename unit_kind_helper<typename Unit::unit_kind_type>::type;
33};
34
35} // namespace unit_kind_detail
36
37/// @brief Alias template for the underlying quantity kind for a unit
38/// @tparam Unit The unit to get the quantity kind for
39template <typename Unit>
41
42} // namespace base
43} // namespace arene
44
45#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UNITS_UNIT_KIND_HPP_
Definition array_exceptions_disabled.cpp:11
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10