25 using details::vector_of_const_;
28 template <
typename F,
size_t... Is>
29 auto for_impl( F&& f, std::index_sequence<Is...> ) {
37 template <auto N,
typename F>
38 decltype(
auto )
for_( F&& f ) {
39 return for_impl( std::forward<F>( f ), std::make_index_sequence<N>{} );
42 template <
typename Sig>
44 template <
typename... Args>
46 template <
typename Sig>
49 template <
typename Signature,
typename Traits_,
bool isLegacy>
53 template <
typename Out,
typename In,
typename Traits_>
60 using KeyValue =
typename base_class::KeyValue;
69 if ( std::is_pointer_v<In> ) {
73 [](
auto&
h ) { h.setOptional( true ); } );
77 static_assert( std::is_void_v<Out> );
86 if ( std::is_pointer_v<In> ) {
90 [](
auto&
h ) { h.setOptional( true ); } );
94 static_assert( !std::is_void_v<Out> );
104 ins.
reserve( m_inputs.size() );
107 if constexpr ( std::is_void_v<Out> ) {
108 std::as_const ( *
this )( std::as_const( ins ) );
110 put( std::get<0>( this->m_outputs ), std::as_const( *
this )( std::as_const( ins ) ) );
123 template <
typename T>
131 template <
typename Out,
typename... Ins,
typename Traits_>
143 constexpr
auto i = decltype( I )::value;
144 auto& ins = std::get<i>( inputs );
148 auto& handles = std::get<i>( this->m_inputs );
149 auto& ins = std::get<i>( this->m_inputLocations );
150 using Handles =
typename std::decay_t<decltype( handles )>;
151 handles = make_vector_of_handles<Handles>(
this, ins );
152 if ( std::is_pointer_v<typename Handles::value_type> ) {
156 std::for_each( handles.begin(), handles.end(), [](
auto&
h ) { h.setOptional( true ); } );
165 :
base_class(
std::move(
name ), locator ), m_inputLocations{ construct_properties( inputs ) } {
166 static_assert( std::is_void_v<Out> );
171 static_assert(
sizeof...( Ins ) == 1 );
176 static_assert( !std::is_void_v<Out> );
181 static_assert(
sizeof...( Ins ) == 1 );
186 return m_inputLocations.
at( i ).value().at(
j ).key();
189 static_assert(
sizeof...( Ins ) == 1 );
190 return inputLocation( 0, i );
192 unsigned int inputLocationSize(
int i = 0 )
const {
return m_inputLocations.at( i ).value().size(); }
198 constexpr
size_t i = decltype( I )::value;
199 auto& ins = std::get<i>( inss );
200 auto& handles = std::get<i>( m_inputs );
201 ins.reserve( handles.size() );
206 if constexpr ( std::is_void_v<Out> ) {
207 std::apply( [&](
auto&&... ins ) {
return std::as_const( *
this )( std::as_const( ins )... ); }, inss );
209 put( std::get<0>( this->m_outputs ),
210 std::apply( [&](
auto&&... ins ) {
return std::as_const( *
this )( std::as_const( ins )... ); },
224 template <
typename T>
235 template <
typename Signature,
typename Traits_ = Traits::useDefaults>
240 typename = std::enable_if_t<details::is_void_fun_v<Signature>>>
244 template <
typename Signature,
typename Traits_ = Traits::BaseClass_t<Gaudi::Algorithm>>
247 template <
typename... Outs,
typename... Ins,
typename Traits_>
259 static constexpr
size_t n_args =
sizeof...( Ins );
263 , m_inputLocations{ details::for_<n_args>( [&](
auto I ) {
264 constexpr
auto i = decltype( I )::value;
265 auto& ins = std::get<i>( inputs );
269 auto& handles = std::get<i>( this->m_inputs );
270 auto& ins = std::get<i>( this->m_inputLocations );
271 using In =
typename std::decay_t<decltype( handles )>::value_type;
273 if ( std::is_pointer_v<In> ) {
276 std::for_each( handles.begin(), handles.end(), [](
auto&
h ) { h.setOptional( true ); } );
284 static_assert(
sizeof...( Ins ) == 1 );
289 return m_inputLocations.
at( i ).value().at(
j ).key();
292 static_assert( n_args == 1 );
293 return inputLocation( 0,
j );
295 unsigned int inputLocationSize(
int i = 0 )
const {
return m_inputLocations.at( i ).value().size(); }
301 constexpr
size_t i = decltype( I )::value;
302 auto& ins = std::get<i>( inss );
303 auto& handles = std::get<i>( m_inputs );
304 ins.reserve( handles.size() );
310 [&](
auto&... outhandle ) {
313 [&outhandle...](
auto&&... data ) {
314 ( details::put( outhandle, std::forward<decltype( data )>( data ) ), ... );
316 std::apply( [&](
auto&&... ins ) { return std::as_const( *this )( std::as_const( ins )... ); },
332 template <
typename T>
342 template <
typename Signature,
typename Traits_ = Traits::BaseClass_t<Gaudi::Algorithm>>
345 template <
typename... Outs,
typename In,
typename Traits_>
367 ins.
reserve( m_inputs.size() );
372 [&](
auto&... outhandle ) {
375 [&outhandle...](
bool passed,
auto&&... data ) {
376 ( details::put( outhandle, std::forward<decltype( data )>( data ) ), ... );
379 ( *
this )( std::as_const( ins ) ) );
395 template <
typename T>
403 template <
typename... Outs,
typename In,
typename Traits_>
407 KeyValues
const& inputs,
408 OutKeys
const& outputs )
409 : base_class(
name, pSvcLocator, outputs )
414 if ( std::is_pointer_v<In> ) {
417 std::for_each( this->m_inputs.begin(), this->m_inputs.end(), [](
auto&
h ) { h.setOptional( true ); } );