23#ifndef DOXYGEN_SHOULD_SKIP_THIS
27 void MLEXPORT logFatalErrorMessageNotEqualTypes(
const char *function,
const MLDataType &inputType,
33 void MLEXPORT logFatalErrorMessageNotSupportedType(
const char *function,
37 template <
typename... T>
38 using TSubImageVariant = std::variant<TSubImage<T>...>;
40 template <
typename T>
struct TSubImagePair
46 template <
typename... T>
47 using TSubImageVariantPair = std::variant<TSubImagePair<T>...>;
50 template <std::
size_t N,
typename T>
51 using TSubImageArray = std::array<TSubImage<T>, N>;
53 template <std::size_t N,
typename ...T>
54 using TSubImageVariantArray = std::variant<TSubImageArray<N, T>...>;
57 template <std::
size_t N,
typename T>
58 struct TSubImageArrayPair
61 std::array<TSubImage<T>, N> inputs;
64 template <std::size_t N,
typename... T>
65 using TSubImageVariantArrayPair = std::variant<TSubImageArrayPair<N, T>...>;
78 auto createTSubImageVariantImpl(
const SubImage* subImage)
80 logFatalErrorMessageNotSupportedType(__FUNCTION__, subImage->getDataType());
84 template <
typename T,
typename U,
typename... V>
85 auto createTSubImageVariantImpl(
const SubImage* subImage)
87 static_assert(!std::is_same_v<std::int8_t, U>,
"The type std::int8_t/signed char is not supported by the "
88 "ML type system. Please use MLint8 instead!");
91 return T{TSubImage<U>(*subImage)};
93 return createTSubImageVariantImpl<T, V...>(subImage);
98 template <
typename T, std::size_t... N>
99 auto createTSubImageArrayImpl(
const SubImage *subImages, std::index_sequence<N...>)
101 return std::array<TSubImage<T>,
sizeof...(N)>{TSubImage<T>(subImages[N])...};
104 template <std::
size_t N,
typename T>
105 auto createTSubImageArray(
const SubImage *inputs)
107 return TSubImageArray<N, T>{createTSubImageArrayImpl<T>(inputs, std::make_index_sequence<N>())};
112 template <std::
size_t N,
typename T>
113 auto createTSubImageArrayPair(SubImage &output,
const SubImage *inputs)
115 return TSubImageArrayPair<N, T>{TSubImage<T>(output),
116 createTSubImageArrayImpl<T>(inputs, std::make_index_sequence<N>())};
121 template <
typename T, std::
size_t N>
122 auto createTSubImageVariantArrayImpl(
const SubImage *inputs)
124 logFatalErrorMessageNotSupportedType(__FUNCTION__, inputs[0].getDataType());
128 template <
typename T, std::size_t N,
typename U,
typename... V>
129 auto createTSubImageVariantArrayImpl(
const SubImage *inputs)
131 static_assert(!std::is_same_v<std::int8_t, U>,
132 "The type std::int8_t/signed char is not supported by the "
133 "ML type system. Please use MLint8 instead!");
137 return T{createTSubImageArray<N, U>(inputs)};
139 return createTSubImageVariantArrayImpl<T, N, V...>(inputs);
144 template <
typename T, std::
size_t N>
145 auto createTSubImageVariantArrayPairImpl(SubImage &output,
const SubImage *inputs)
147 logFatalErrorMessageNotSupportedType(__FUNCTION__, output.getDataType());
151 template <
typename T, std::size_t N,
typename U,
typename... V>
152 auto createTSubImageVariantArrayPairImpl(SubImage &output,
const SubImage *inputs)
154 static_assert(!std::is_same_v<std::int8_t, U>,
"The type std::int8_t/signed char is not supported by the "
155 "ML type system. Please use MLint8 instead!");
159 return T{createTSubImageArrayPair<N, U>(output, inputs)};
161 return createTSubImageVariantArrayPairImpl<T, N, V...>(output, inputs);
166 template <
typename T>
167 auto createTSubImageVariantPairImpl(SubImage &output,
const SubImage*)
169 logFatalErrorMessageNotSupportedType(__FUNCTION__, output.getDataType());
173 template <
typename T,
typename U,
typename... V>
174 auto createTSubImageVariantPairImpl(SubImage &output,
const SubImage* input)
176 static_assert(!std::is_same_v<std::int8_t, U>,
177 "The type std::int8_t/signed char is not supported by the "
178 "ML type system. Please use MLint8 instead!");
182 return T{TSubImagePair<U>{output, *input}};
184 return createTSubImageVariantPairImpl<T, V...>(output, input);
241 template <
typename... T>
244 return detail::createTSubImageVariantImpl<TSubImageVariant<T...>, T...>(subImage);
275 template <
typename... T>
278 return detail::createTSubImageVariantPairImpl<TSubImageVariantPair<T...>, T...>(output, input);
315 template <std::size_t N,
typename... T>
318 return detail::createTSubImageVariantArrayImpl<TSubImageVariantArray<N, T...>, N, T...>(inputs);
354 template <std::size_t N,
typename... T>
358 TSubImageVariantArrayPair<N, T...> result;
360 for (std::size_t i = 0; i < N; ++i)
364 logFatalErrorMessageNotEqualTypes(__FUNCTION__, inputs[0].getDataType(),
370 result = detail::createTSubImageVariantArrayPairImpl<TSubImageVariantArrayPair<N, T...>, N, T...>(
This class manages/represents a rectangular 6d image region which is organized linearly in memory.
MLDataType getDataType() const
Return type of image data.
MLint32 MLDataType
MLDataType.
#define MLEXPORT
To export symbols from a dll/shared object, we need to mark them with the MLEXPORT symbol.
Main documentation file for ML users and developers.
TSubImageVariantArray< N, T... > createTSubImageVariantArray(const SubImage *inputs)
TSubImageVariantPair< T... > createTSubImageVariantPair(SubImage &output, const SubImage *input)
TSubImageVariantArrayPair< N, T... > createTSubImageVariantArrayPair(SubImage &output, const SubImage *inputs)
TSubImageVariant< T... > createTSubImageVariant(const SubImage *subImage)
static MLDataType getDataType()
Return the data type.