The Gaudi Framework  master (b9786168)
Loading...
Searching...
No Matches
Consumer.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2024 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
13#include "details.h"
14#include "utilities.h"
16
17#include <tuple>
18
20
21 namespace details {
22
23 template <typename Signature, typename Traits_, bool isLegacy>
24 struct Consumer;
25
26 template <typename... In, typename Traits_>
27 struct Consumer<void( const In&... ), Traits_, true>
28 : DataHandleMixin<std::tuple<>, filter_evtcontext<In...>, Traits_> {
29 using DataHandleMixin<std::tuple<>, filter_evtcontext<In...>, Traits_>::DataHandleMixin;
30
31 // derived classes are NOT allowed to implement execute ...
32 StatusCode execute() override final {
33 try {
34 filter_evtcontext_t<In...>::apply( *this, this->m_inputs );
36 } catch ( GaudiException& e ) {
37 if ( e.code().isFailure() ) this->error() << e.tag() << " : " << e.message() << endmsg;
38 return e.code();
39 }
40 }
41
42 // ... instead, they must implement the following operator
43 virtual void operator()( const In&... ) const = 0;
44 };
45
46 template <typename... In, typename Traits_>
47 struct Consumer<void( const In&... ), Traits_, false>
48 : DataHandleMixin<std::tuple<>, filter_evtcontext<In...>, Traits_> {
49 using DataHandleMixin<std::tuple<>, filter_evtcontext<In...>, Traits_>::DataHandleMixin;
50
51 // derived classes are NOT allowed to implement execute ...
52 StatusCode execute( const EventContext& ctx ) const override final {
53 try {
54 filter_evtcontext_t<In...>::apply( *this, ctx, this->m_inputs );
56 } catch ( GaudiException& e ) {
57 if ( e.code().isFailure() ) this->error() << e.tag() << " : " << e.message() << endmsg;
58 return e.code();
59 }
60 }
61
62 // ... instead, they must implement the following operator
63 virtual void operator()( const In&... ) const = 0;
64 };
65
66 } // namespace details
67
68 template <typename Signature, typename Traits_ = Traits::useDefaults>
70
71} // namespace Gaudi::Functional
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
This class represents an entry point to all the event specific data.
Define general base for Gaudi exception.
virtual const std::string & message() const
error message to be printed
virtual const StatusCode & code() const
StatusCode for Exception.
virtual const std::string & tag() const
name tag for the exception, or exception type
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
bool isFailure() const
Definition StatusCode.h:129
typename filter_evtcontext_t< In... >::type filter_evtcontext
Definition details.h:534
details::Consumer< Signature, Traits_, details::isLegacy< Traits_ > > Consumer
Definition Consumer.h:69
STL namespace.
StatusCode execute(const EventContext &ctx) const override final
Definition Consumer.h:52
static auto apply(const Algorithm &algo, const EventContext &ctx, Handles &handles)
Definition details.h:504