| The Gaudi Framework v28r2p1 (f1a77ff4)

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

- File List
- File Members

FilterPredicate.h
Go to the documentation of this file.
1 #ifndef FILTER_PREDICATE_H
2 #define FILTER_PREDICATE_H
3
4 #include <utility>
5 #include <type_traits>
6 #include "GaudiAlg/FunctionalDetails.h"
7 #include "GaudiAlg/FunctionalUtilities.h"
8
9 namespace Gaudi { namespace Functional {
10
11 template <typename T, typename Traits_ = Traits::useDefaults> class FilterPredicate;
12
13 template <typename... In, typename Traits_>
14 class FilterPredicate<bool(const In&...),Traits_>
15 : public details::DataHandleMixin<void,std::tuple<In...>,Traits_> {
16 public:
17 using details::DataHandleMixin<void,std::tuple<In...>,Traits_>::DataHandleMixin;
18
19 // derived classes are NOT allowed to implement execute ...
20 StatusCode execute() override final
21 { return invoke(std::index_sequence_for<In...>{}); }
22
23 // ... instead, they must implement the following operator
24 virtual bool operator()(const In&...) const = 0;
25
26 private:
27
28 // note: invoke is not const, as setFilterPassed is not (yet!) const
29 template <std::size_t... I>
30 StatusCode invoke(std::index_sequence<I...>) {
31 using details::as_const;
32 try {
33 auto pass = as_const(*this)( as_const(*std::get<I>(this->m_inputs).get())... );
34 this->setFilterPassed( pass );
35 } catch ( GaudiException& e ) {
36 (e.code() ? this->warning() : this->error() )
37 << e.message() << endmsg;
38 return e.code();
39 }
40 return StatusCode::SUCCESS;
41 }
42 };
43
44 }}
45
46 #endif
Gaudi::Functional::FilterPredicate
Definition: FilterPredicate.h:11
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::FilterPredicate< bool(const In &...), Traits_ >::execute
StatusCode execute() override final
Definition: FilterPredicate.h:20
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::FilterPredicate< bool(const In &...), Traits_ >::invoke
StatusCode invoke(std::index_sequence< I... >)
Definition: FilterPredicate.h:30
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