20 #ifndef otb_VariadicInputsImageFilter_h
21 #define otb_VariadicInputsImageFilter_h
23 #include "itkImageSource.h"
57 template <
class TOuptut,
class... TInputs>
70 using InputImageType =
typename std::tuple_element<I, InputTypesTupleType>::type;
71 static constexpr
size_t NumberOfInputs = std::tuple_size<InputTypesTupleType>::value;
78 using Superclass::GetInput;
79 using Superclass::SetInput;
84 template <std::
size_t I = 0>
87 static_assert(
NumberOfInputs > I,
"Template value I is out of range.");
92 #define DefineLegacySetInputMacro(n) \
93 template <typename Tuple = InputTypesTupleType, typename Check = typename std::enable_if<n <= std::tuple_size<Tuple>::value>::type> \
94 void SetInput##n(const typename std::tuple_element<n - 1, Tuple>::type* img) \
96 this->template SetInput<n - 1>(img); \
112 #undef DefineLegacySetInputMacro
114 template <std::
size_t I = 0>
117 static_assert(
NumberOfInputs > I,
"Template value I is out of range.");
126 auto inTuple = std::make_tuple(inputs...);
127 SetInputsImpl(inTuple, std::make_index_sequence<
sizeof...(inputs)>{});
136 return GetInputsImpl(std::make_index_sequence<
sizeof...(TInputs)>{});
143 this->SetNumberOfRequiredInputs(
sizeof...(TInputs));
149 template <
class Tuple,
size_t... Is>
154 (void) std::initializer_list<int>{(this->
template SetInput<Is>(std::get<Is>(t)), 0)...};
157 template <
size_t... Is>
160 return std::make_tuple(this->
template GetInput<Is>()...);