RTC Toolkit 6.0.0
Loading...
Searching...
No Matches
recordingTypeTraits.hpp
Go to the documentation of this file.
1
11#ifndef RTCTK_COMPONENTFRAMEWORK_RECORDINGTYPETRAITS_HPP
12#define RTCTK_COMPONENTFRAMEWORK_RECORDINGTYPETRAITS_HPP
13
14#include <array>
15#include <cstdint>
16#include <gsl/span>
19#include <type_traits>
20
22
26template <typename T>
27struct AsSpan {};
28
29template <typename T, size_t Size>
30struct AsSpan<std::array<T, Size>> {
31 using TYPE = gsl::span<T, static_cast<decltype(gsl::dynamic_extent)>(Size)>;
32};
33
34template <typename T, size_t Size>
35struct AsSpan<const std::array<T, Size>> {
36 using TYPE = gsl::span<const T, static_cast<decltype(gsl::dynamic_extent)>(Size)>;
37};
38
39template <typename T, typename Allocator>
40struct AsSpan<std::vector<T, Allocator>> {
41 using TYPE = gsl::span<T>;
42};
43
44template <typename T, typename Allocator>
45struct AsSpan<MatrixBuffer<T, Allocator>> {
46 using TYPE = gsl::span<T>;
47};
48
49template <typename T>
50using AsSpanT = typename AsSpan<T>::TYPE;
51
55template <typename T>
57 : std::
58 conjunction<IsSpanType<T>, IsDynamicSpanType<T>, IsVectorType<T>, IsMatrixBufferType<T>> {
59};
60
64template <typename T>
66
67} // namespace rtctk::componentFramework
68
69#endif // RTCTK_COMPONENTFRAMEWORK_RECORDINGTYPETRAITS_HPP
A buffer class representing 2D matrix data.
Definition matrixBuffer.hpp:27
Declaration of the MatrixBuffer template class used in APIs.
Definition commandReplier.cpp:21
typename AsSpan< T >::TYPE AsSpanT
Definition recordingTypeTraits.hpp:50
constexpr bool IS_SPAN_CONVERTIBLE
Small helper alias for IsSpanConvertible.
Definition recordingTypeTraits.hpp:65
Definition ddsSub.hpp:155
gsl::span< T > TYPE
Definition recordingTypeTraits.hpp:46
gsl::span< const T, static_cast< decltype(gsl::dynamic_extent)>(Size)> TYPE
Definition recordingTypeTraits.hpp:36
gsl::span< T, static_cast< decltype(gsl::dynamic_extent)>(Size)> TYPE
Definition recordingTypeTraits.hpp:31
gsl::span< T > TYPE
Definition recordingTypeTraits.hpp:41
Gets the span type for converting type T to a span.
Definition recordingTypeTraits.hpp:27
Type trait to check if a type can be converted to a Span using AsSpan/ToSpan.
Definition recordingTypeTraits.hpp:58
Provides useful mechanisms to test various type traits.