mmcfilters
Public API documentation
Loading...
Searching...
No Matches
Altitude.hpp
Go to the documentation of this file.
1#pragma once
2
8#include <concepts>
9#include <cstdint>
10#include <span>
11#include <type_traits>
12#include <vector>
13
14namespace mmcfilters {
15
16namespace detail {
17
19template <class T>
20inline constexpr bool SupportedIntegralAltitude = std::is_integral_v<std::remove_cv_t<T>> && sizeof(std::remove_cv_t<T>) < sizeof(std::int64_t);
21
23template <class T> inline constexpr bool SupportedFloatingAltitude = std::is_floating_point_v<std::remove_cv_t<T>>;
24
25} // namespace detail
26
38template <class T>
40 std::totally_ordered<T> && !std::is_same_v<std::remove_cv_t<T>, bool> && (detail::SupportedFloatingAltitude<T> || detail::SupportedIntegralAltitude<T>);
41
48template <AltitudeValue T> using NodeAltitudeSpan = std::span<const T>;
49
50namespace detail {
51
57template <AltitudeValue T> struct AltitudeDifferenceSelector {
59 using type = std::conditional_t<std::is_integral_v<T>, std::int64_t, T>;
60};
61
62} // namespace detail
63
72template <AltitudeValue T> using AltitudeDifference = typename detail::AltitudeDifferenceSelector<T>::type;
73
81template <AltitudeValue T> using NodeAltitudeBuffer = std::vector<T>;
82
83} // namespace mmcfilters
typename detail::AltitudeDifferenceSelector< T >::type AltitudeDifference
Arithmetic result type for altitude differences.
Definition Altitude.hpp:72
constexpr bool SupportedFloatingAltitude
True when T is a floating-point altitude type.
Definition Altitude.hpp:23
constexpr bool SupportedIntegralAltitude
True when T is an integral altitude type with safe 64-bit differences.
Definition Altitude.hpp:20
std::vector< T > NodeAltitudeBuffer
Owning dense altitude buffer indexed by internal node id.
Definition Altitude.hpp:81
std::span< const T > NodeAltitudeSpan
Read-only contiguous view over node altitudes.
Definition Altitude.hpp:48
Value types accepted by generic altitude helpers.
Definition Altitude.hpp:39