The Gaudi Framework  v32r0 (3325bb39)
Consumer.h
Go to the documentation of this file.
1 #ifndef GAUDI_FUNCTIONAL_CONSUMER_H
2 #define GAUDI_FUNCTIONAL_CONSUMER_H
3 
6 #include <utility>
7 
8 namespace Gaudi::Functional {
9 
10  namespace details {
11 
12  template <typename Signature, typename Traits_, bool isLegacy>
13  struct Consumer;
14 
15  template <typename... In, typename Traits_>
16  struct Consumer<void( const In&... ), Traits_, true>
19 
20  // derived classes are NOT allowed to implement execute ...
21  StatusCode execute() override final {
22  try {
24  return StatusCode::SUCCESS;
25  } catch ( GaudiException& e ) {
26  ( e.code() ? this->warning() : this->error() ) << e.message() << endmsg;
27  return e.code();
28  }
29  }
30 
31  // ... instead, they must implement the following operator
32  virtual void operator()( const In&... ) const = 0;
33  };
34 
35  template <typename... In, typename Traits_>
36  struct Consumer<void( const In&... ), Traits_, false>
39 
40  // derived classes are NOT allowed to implement execute ...
41  StatusCode execute( const EventContext& ctx ) const override final {
42  try {
44  return StatusCode::SUCCESS;
45  } catch ( GaudiException& e ) {
46  ( e.code() ? this->warning() : this->error() ) << e.message() << endmsg;
47  return e.code();
48  }
49  }
50 
51  // ... instead, they must implement the following operator
52  virtual void operator()( const In&... ) const = 0;
53  };
54 
55  } // namespace details
56 
57  template <typename Signature, typename Traits_ = Traits::useDefaults>
59 
60 } // namespace Gaudi::Functional
61 
62 #endif
virtual const std::string & message() const
error message to be printed
Define general base for Gaudi exception.
virtual Out operator()(const vector_of_const_< In > &inputs) const =0
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
typename filter_evtcontext_t< In... >::type filter_evtcontext
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
virtual const StatusCode & code() const
StatusCode for Exception.
std::vector< InputHandle_t< In > > m_inputs
class MergingTransformer< Out(const vector_of_const_< In > Traits_
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
static auto apply(const Algorithm &algo, Handles &handles)
StatusCode execute(const EventContext &ctx) const override final
Definition: Consumer.h:41
class MergingTransformer< Out(const vector_of_const_< In > void
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192