| The Gaudi Framework v29r1 (5cd95fa2)

- 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 "GaudiAlg/FunctionalDetails.h"
5 #include "GaudiAlg/FunctionalUtilities.h"
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
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition: GaudiException.h:99
StatusCode::SUCCESS
Definition: StatusCode.h:31
Gaudi::Functional::details::as_const
constexpr std::add_const< T >::type & as_const(T &t) noexcept
Definition: FunctionalDetails.h:104
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:22
Gaudi::Functional::Consumer< void(const In &...), Traits_ >::invoke
StatusCode invoke(std::index_sequence< I... >) const
Definition: Consumer.h:30
Gaudi::Functional::void
class MergingTransformer< Out(const vector_of_const_< In > void
Definition: MergingTransformer.h:23
std::size_t
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition: GaudiException.h:119
Gaudi::Functional::details::DataHandleMixin
Definition: FunctionalDetails.h:438
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
FunctionalUtilities.h
std::tuple
Gaudi::Functional::m_inputs
std::vector< InputHandle_t< In > > m_inputs
Definition: MergingTransformer.h:45
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:23
Gaudi::Functional::Traits_
struct[[deprecated("use MergingTransformer instead")]] Traits_
Definition: ListTransformer.h:14
Gaudi::invoke
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
Gaudi::Functional::Consumer
Definition: Consumer.h:14
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:209
FunctionalDetails.h