All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Consumer.h
Go to the documentation of this file.
1 #ifndef GAUDI_FUNCTIONAL_CONSUMER_H
2 #define GAUDI_FUNCTIONAL_CONSUMER_H
3 
4 #include <utility>
7 
8 namespace Gaudi { namespace Functional {
9 
10  template <typename Signature, typename Traits_ = Traits::useDefaults> class Consumer;
11 
12  template <typename... In, typename Traits_>
13  class Consumer<void(const In&...),Traits_>
15  public:
16  using details::DataHandleMixin<void,std::tuple<In...>,Traits_>::DataHandleMixin;
17 
18  // derived classes are NOT allowed to implement execute ...
19  StatusCode execute() override final
20  { return invoke(std::index_sequence_for<In...>{}); }
21 
22  // ... instead, they must implement the following operator
23  virtual void operator()(const In&...) const = 0;
24 
25  private:
26  template <std::size_t... I>
27  StatusCode invoke(std::index_sequence<I...>) const {
28  try {
29  (*this)( details::as_const(*std::get<I>(this->m_inputs).get())... );
30  } catch ( GaudiException& e ) {
31  ( e.code() ? this->warning() : this->error() )
32  << e.message() << endmsg;
33  return e.code();
34  }
35  return StatusCode::SUCCESS;
36  }
37  };
38 }}
39 
40 #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:27
class MergingTransformer< Out(const vector_of_const_< In > void
virtual const StatusCode & code() const
StatusCode for Exception.
class MergingTransformer< Out(const vector_of_const_< In > Traits_
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::vector< InputHandle_t< In > > m_inputs
virtual Out operator()(const vector_of_const_< In > &inputs) const =0
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:244