The Gaudi Framework  master (e98cfcff)
Loading...
Searching...
No Matches
MergingTransformer.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2026 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#pragma once
12#include "details.h"
13#include "utilities.h"
14#include <Gaudi/Algorithm.h>
15#include <tuple>
16
17namespace Gaudi::Functional {
18
19 namespace details {
20
21 template <typename Sig>
22 constexpr bool is_void_fun_v = false;
23 template <typename... Args>
24 constexpr bool is_void_fun_v<void( Args... )> = true;
25 template <typename Sig>
27
28 template <typename Signature, typename Traits_, bool isLegacy>
30
32 template <typename Out, typename... Args, typename Traits_>
33 requires has_handle_vector_input<Args...>
34 struct MergingTransformer<Out( const Args&... ), Traits_, true>
35 : DataHandleVectorMixin<type_list<Out>, Traits_, Args...> {
37
38 // derived classes can NOT implement execute
39 StatusCode execute() override final {
40 return execute_single_output( *this, this->getContext(), this->m_outputs );
41 }
42
43 virtual Out operator()( const Args&... inputs ) const = 0;
44 };
45
47 template <typename Out, typename... Args, typename Traits_>
48 requires has_handle_vector_input<Args...>
49 struct MergingTransformer<Out( const Args&... ), Traits_, false>
50 : DataHandleVectorMixin<type_list<Out>, Traits_, Args...> {
52
53 // derived classes can NOT implement execute
54 StatusCode execute( const EventContext& ctx ) const override final {
55 return execute_single_output( *this, ctx, this->m_outputs );
56 }
57
58 virtual Out operator()( const Args&... inputs ) const = 0;
59 };
60
61 } // namespace details
62
63 template <typename Signature, typename Traits_ = Traits::useDefaults>
65
66 // more meaningful alias for cases where the return type in Signature is void
67 template <details::is_void_fun Signature, typename Traits_ = Traits::useDefaults>
69
71
72 // Merging inputs -> N
73 template <typename Signature, typename Traits_ = Traits::BaseClass_t<Gaudi::Algorithm>>
75
76 template <typename... Outs, typename... Args, typename Traits_>
77 requires details::has_handle_vector_input<Args...>
78 struct MergingMultiTransformer<std::tuple<Outs...>( const Args&... ), Traits_>
79 : details::DataHandleVectorMixin<details::type_list<Outs...>, Traits_, Args...> {
80 using details::DataHandleVectorMixin<details::type_list<Outs...>, Traits_, Args...>::DataHandleVectorMixin;
81
82 // derived classes can NOT implement execute
83 StatusCode execute( EventContext const& ctx ) const override final {
84 return details::execute_outputs( *this, ctx, this->m_outputs );
85 }
86
87 virtual std::tuple<Outs...> operator()( const Args&... inputs ) const = 0;
88 };
89
90 // Merging inputs -> N with filter functionality
91 template <typename Signature, typename Traits_ = Traits::BaseClass_t<Gaudi::Algorithm>>
93
94 template <typename... Outs, typename... Args, typename Traits_>
95 requires details::has_handle_vector_input<Args...>
96 struct MergingMultiTransformerFilter<std::tuple<Outs...>( const Args&... ), Traits_>
97 : details::DataHandleVectorMixin<details::type_list<Outs...>, Traits_, Args...> {
98 using details::DataHandleVectorMixin<details::type_list<Outs...>, Traits_, Args...>::DataHandleVectorMixin;
99
100 // derived classes can NOT implement execute
101 StatusCode execute( EventContext const& ctx ) const override final {
102 return details::execute_filtered_outputs( *this, ctx, this->m_outputs );
103 }
104
105 virtual std::tuple<bool, Outs...> operator()( const Args&... inputs ) const = 0;
106 };
107
108} // namespace Gaudi::Functional
This class represents an entry point to all the event specific data.
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
StatusCode execute_outputs(const Algorithm &algo, const EventContext &ctx, const OutHandles &out_handles)
Definition details.h:966
StatusCode execute_single_output(const Algorithm &algo, const EventContext &ctx, const OutHandles &out_handles={})
Definition details.h:952
StatusCode execute_filtered_outputs(const Algorithm &algo, const EventContext &ctx, const OutHandles &out_handles)
Definition details.h:974
DataHandleMixin< Outputs, type_list< handle_vector_input_t< Args >... >, Traits_ > DataHandleVectorMixin
Definition details.h:752
details::MergingTransformer< Signature, Traits_, details::isLegacy< Traits_ > > MergingTransformer
details::MergingTransformer< Signature, Traits_, details::isLegacy< Traits_ > > MergingConsumer
STL namespace.
virtual std::tuple< bool, Outs... > operator()(const Args &... inputs) const =0
virtual std::tuple< Outs... > operator()(const Args &... inputs) const =0