| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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>
5 #include "GaudiAlg/FunctionalDetails.h"
6 #include "GaudiAlg/FunctionalUtilities.h"
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_>
14 : public details::DataHandleMixin<void,std::tuple<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
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition: GaudiException.h:111
StatusCode::SUCCESS
Definition: StatusCode.h:30
Gaudi::Functional::details::as_const
constexpr std::add_const< T >::type & as_const(T &t) noexcept
Definition: FunctionalDetails.h:77
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
Gaudi::Functional::Consumer< void(const In &...), Traits_ >::invoke
StatusCode invoke(std::index_sequence< I... >) const
Definition: Consumer.h:27
Gaudi::Functional::void
class MergingTransformer< Out(const vector_of_const_< In > void
Definition: MergingTransformer.h:19
std::size_t
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition: GaudiException.h:127
Gaudi::Functional::details::DataHandleMixin
Definition: FunctionalDetails.h:317
Gaudi::Functional::Traits_
class MergingTransformer< Out(const vector_of_const_< In > Traits_
Definition: MergingTransformer.h:19
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
FunctionalUtilities.h
std::tuple
Gaudi::Functional::m_inputs
std::vector< InputHandle_t< In > > m_inputs
Definition: MergingTransformer.h:39
Gaudi::Functional::operator()
virtual Out operator()(const vector_of_const_< In > &inputs) const =0
Gaudi::Functional::Consumer< void(const In &...), Traits_ >::execute
StatusCode execute() override final
Definition: Consumer.h:19
Gaudi::Functional::Consumer
Definition: Consumer.h:10
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
FunctionalDetails.h