The Gaudi Framework  v29r0 (ff2e7097)
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
9 {
10  namespace Functional
11  {
12 
13  template <typename Signature, typename Traits_ = Traits::useDefaults>
14  class Consumer;
15 
16  template <typename... In, typename Traits_>
17  class Consumer<void( const In&... ), Traits_> : public details::DataHandleMixin<void, std::tuple<In...>, Traits_>
18  {
19  public:
20  using details::DataHandleMixin<void, std::tuple<In...>, Traits_>::DataHandleMixin;
21 
22  // derived classes are NOT allowed to implement execute ...
23  StatusCode execute() override final { return invoke( std::index_sequence_for<In...>{} ); }
24 
25  // ... instead, they must implement the following operator
26  virtual void operator()( const In&... ) const = 0;
27 
28  private:
29  template <std::size_t... I>
30  StatusCode invoke( std::index_sequence<I...> ) const
31  {
32  try {
33  ( *this )( details::as_const( *std::get<I>( this->m_inputs ).get() )... );
34  } catch ( GaudiException& e ) {
35  ( e.code() ? this->warning() : this->error() ) << e.message() << endmsg;
36  return e.code();
37  }
38  return StatusCode::SUCCESS;
39  }
40  };
41  }
42 }
43 
44 #endif
virtual const std::string & message() const
error message to be printed
constexpr std::add_const< T >::type & as_const(T &t) noexcept
Define general base for Gaudi exception.
StatusCode invoke(std::index_sequence< I... >) const
Definition: Consumer.h:30
class MergingTransformer< Out(const vector_of_const_< In > void
virtual const StatusCode & code() const
StatusCode for Exception.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
std::vector< InputHandle_t< In > > m_inputs
virtual Out operator()(const vector_of_const_< In > &inputs) const =0
struct[[deprecated("use MergingTransformer instead")]] Traits_
auto invoke(F &&f, ArgTypes &&...args) noexcept(noexcept(detail2::INVOKE(std::forward< F >(f), std::forward< ArgTypes >(args)...))) -> decltype(detail2::INVOKE(std::forward< F >(f), std::forward< ArgTypes >(args)...))
Definition: invoke.h:83
Helper functions to set/get the application return code.
Definition: __init__.py:1
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209