File indexing completed on 2025-01-18 09:57:29
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #pragma once
0012
0013 #include "details.h"
0014 #include "utilities.h"
0015 #include <GaudiKernel/FunctionalFilterDecision.h>
0016 #include <utility>
0017
0018 namespace Gaudi::Functional {
0019
0020 namespace details {
0021
0022 template <typename Signature, typename Traits_, bool isLegacy>
0023 struct Consumer;
0024
0025 template <typename... In, typename Traits_>
0026 struct Consumer<void( const In&... ), Traits_, true>
0027 : DataHandleMixin<std::tuple<>, filter_evtcontext<In...>, Traits_> {
0028 using DataHandleMixin<std::tuple<>, filter_evtcontext<In...>, Traits_>::DataHandleMixin;
0029
0030
0031 StatusCode execute() override final {
0032 try {
0033 filter_evtcontext_t<In...>::apply( *this, this->m_inputs );
0034 return FilterDecision::PASSED;
0035 } catch ( GaudiException& e ) {
0036 if ( e.code().isFailure() ) this->error() << e.tag() << " : " << e.message() << endmsg;
0037 return e.code();
0038 }
0039 }
0040
0041
0042 virtual void operator()( const In&... ) const = 0;
0043 };
0044
0045 template <typename... In, typename Traits_>
0046 struct Consumer<void( const In&... ), Traits_, false>
0047 : DataHandleMixin<std::tuple<>, filter_evtcontext<In...>, Traits_> {
0048 using DataHandleMixin<std::tuple<>, filter_evtcontext<In...>, Traits_>::DataHandleMixin;
0049
0050
0051 StatusCode execute( const EventContext& ctx ) const override final {
0052 try {
0053 filter_evtcontext_t<In...>::apply( *this, ctx, this->m_inputs );
0054 return FilterDecision::PASSED;
0055 } catch ( GaudiException& e ) {
0056 if ( e.code().isFailure() ) this->error() << e.tag() << " : " << e.message() << endmsg;
0057 return e.code();
0058 }
0059 }
0060
0061
0062 virtual void operator()( const In&... ) const = 0;
0063 };
0064
0065 }
0066
0067 template <typename Signature, typename Traits_ = Traits::useDefaults>
0068 using Consumer = details::Consumer<Signature, Traits_, details::isLegacy<Traits_>>;
0069
0070 }