MorphologicalAttributeFilters
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 =
21 std::is_integral_v<std::remove_cv_t<T>> &&
22 sizeof(std::remove_cv_t<T>) < sizeof(std::int64_t);
23
25template<class T>
26inline constexpr bool SupportedFloatingAltitude = std::is_floating_point_v<std::remove_cv_t<T>>;
27
28} // namespace detail
29
41template<class T>
43 std::totally_ordered<T> &&
44 !std::is_same_v<std::remove_cv_t<T>, bool> &&
45 (detail::SupportedFloatingAltitude<T> || detail::SupportedIntegralAltitude<T>);
46
53template<AltitudeValue T>
54using AltitudeSpan = std::span<const T>;
55
56namespace detail {
57
58template<AltitudeValue T>
59struct AltitudeDiffSelector {
60 using type = std::conditional_t<std::is_integral_v<T>, std::int64_t, T>;
61};
62
63} // namespace detail
64
73template<AltitudeValue T>
74using AltitudeDiff = typename detail::AltitudeDiffSelector<T>::type;
75
83template<AltitudeValue T>
84using AltitudeBuffer = std::vector<T>;
85
86} // namespace mmcfilters
std::vector< T > AltitudeBuffer
Owning dense altitude buffer indexed by internal node id.
Definition Altitude.hpp:84
typename detail::AltitudeDiffSelector< T >::type AltitudeDiff
Arithmetic result type for altitude differences.
Definition Altitude.hpp:74
constexpr bool SupportedFloatingAltitude
True when T is a floating-point altitude type.
Definition Altitude.hpp:26
constexpr bool SupportedIntegralAltitude
True when T is an integral altitude type with safe 64-bit differences.
Definition Altitude.hpp:20
std::span< const T > AltitudeSpan
Read-only contiguous view over node altitudes.
Definition Altitude.hpp:54
Value types accepted by generic altitude helpers.
Definition Altitude.hpp:42
Owning result for one computed scalar attribute layout and buffer.