The Gaudi Framework  v30r2 (9eca68f7)
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
24  {
25  try {
26  invoke( std::index_sequence_for<In...>{} );
27  } catch ( GaudiException& e ) {
28  ( e.code() ? this->warning() : this->error() ) << e.message() << endmsg;
29  return e.code();
30  }
31  return StatusCode::SUCCESS;
32  }
33 
34  // ... instead, they must implement the following operator
35  virtual void operator()( const In&... ) const = 0;
36 
37  private:
38  template <std::size_t... I>
39  void invoke( std::index_sequence<I...> ) const
40  {
41  ( *this )( details::deref( std::get<I>( this->m_inputs ).get() )... );
42  }
43  };
44  }
45 }
46 
47 #endif
virtual const std::string & message() const
error message to be printed
Define general base for Gaudi exception.
void invoke(std::index_sequence< I... >) const
Definition: Consumer.h:39
class MergingTransformer< Out(const vector_of_const_< In > void
constexpr struct Gaudi::Functional::details::deref_t deref
virtual const StatusCode & code() const
StatusCode for Exception.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
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:85
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