The Gaudi Framework  v39r1 (adb068b2)
Consumer.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2023 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 #include <utility>
17 
18 namespace Gaudi::Functional {
19 
20  namespace details {
21 
22  template <typename Signature, typename Traits_, bool isLegacy>
23  struct Consumer;
24 
25  template <typename... In, typename Traits_>
26  struct Consumer<void( const In&... ), Traits_, true>
29 
30  // derived classes are NOT allowed to implement execute ...
31  StatusCode execute() override final {
32  try {
33  filter_evtcontext_t<In...>::apply( *this, this->m_inputs );
35  } catch ( GaudiException& e ) {
36  if ( e.code().isFailure() ) this->error() << e.tag() << " : " << e.message() << endmsg;
37  return e.code();
38  }
39  }
40 
41  // ... instead, they must implement the following operator
42  virtual void operator()( const In&... ) const = 0;
43  };
44 
45  template <typename... In, typename Traits_>
46  struct Consumer<void( const In&... ), Traits_, false>
49 
50  // derived classes are NOT allowed to implement execute ...
51  StatusCode execute( const EventContext& ctx ) const override final {
52  try {
53  filter_evtcontext_t<In...>::apply( *this, ctx, this->m_inputs );
55  } catch ( GaudiException& e ) {
56  if ( e.code().isFailure() ) this->error() << e.tag() << " : " << e.message() << endmsg;
57  return e.code();
58  }
59  }
60 
61  // ... instead, they must implement the following operator
62  virtual void operator()( const In&... ) const = 0;
63  };
64 
65  } // namespace details
66 
67  template <typename Signature, typename Traits_ = Traits::useDefaults>
69 
70 } // namespace Gaudi::Functional
Gaudi::Functional::details::Consumer< void(const In &...), Traits_, false >::operator()
virtual void operator()(const In &...) const =0
GaudiException
Definition: GaudiException.h:31
std::tuple
Gaudi::Functional::details::Consumer
Definition: Consumer.h:23
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition: GaudiException.h:68
Gaudi::Functional::details::Consumer< void(const In &...), Traits_, false >::execute
StatusCode execute(const EventContext &ctx) const override final
Definition: Consumer.h:51
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:578
StatusCode
Definition: StatusCode.h:65
details
Definition: AnyDataWrapper.h:19
Gaudi::Functional::details::Consumer< void(const In &...), Traits_, true >::operator()
virtual void operator()(const In &...) const =0
Gaudi::Functional::details::filter_evtcontext_t::apply
static auto apply(const Algorithm &algo, Handles &handles)
Definition: details.h:473
Gaudi::Functional::FilterDecision::PASSED
@ PASSED
Gaudi::Functional
Definition: Consumer.h:18
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:203
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:77
utilities.h
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition: GaudiException.h:86
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:129
EventContext
Definition: EventContext.h:34
Gaudi::Functional::details::DataHandleMixin
Definition: details.h:507
Gaudi::Functional::details::Consumer< void(const In &...), Traits_, true >::execute
StatusCode execute() override final
Definition: Consumer.h:31
details.h
FunctionalFilterDecision.h
Gaudi::Functional::details::filter_evtcontext
typename filter_evtcontext_t< In... >::type filter_evtcontext
Definition: details.h:504