| The Gaudi Framework v30r0 (c919700c)

- 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 "GaudiAlg/FunctionalDetails.h"
5 #include "GaudiAlg/FunctionalUtilities.h"
6 #include <type_traits>
7 #include <utility>
8
9 namespace Gaudi
10 {
11 namespace Functional
12 {
13
14 template <typename T, typename Traits_ = Traits::useDefaults>
15 class FilterPredicate;
16
17 template <typename... In, typename Traits_>
18 class FilterPredicate<bool( const In&... ), Traits_>
19 : public details::DataHandleMixin<void, std::tuple<In...>, Traits_>
20 {
21 public:
22 using details::DataHandleMixin<void, std::tuple<In...>, Traits_>::DataHandleMixin;
23
24 // derived classes are NOT allowed to implement execute ...
25 StatusCode execute() override final { return invoke( std::index_sequence_for<In...>{} ); }
26
27 // ... instead, they must implement the following operator
28 virtual bool operator()( const In&... ) const = 0;
29
30 private:
31 // note: invoke is not const, as setFilterPassed is not (yet!) const
32 template <std::size_t... I>
33 StatusCode invoke( std::index_sequence<I...> )
34 {
35 using details::as_const;
36 try {
37 auto pass = as_const( *this )( as_const( *std::get<I>( this->m_inputs ).get() )... );
38 this->setFilterPassed( pass );
39 } catch ( GaudiException& e ) {
40 ( e.code() ? this->warning() : this->error() ) << e.message() << endmsg;
41 return e.code();
42 }
43 return StatusCode::SUCCESS;
44 }
45 };
46 }
47 }
48
49 #endif
Gaudi::Functional::FilterPredicate
Definition: FilterPredicate.h:15
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition: GaudiException.h:99
StatusCode::SUCCESS
Definition: StatusCode.h:29
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:22
Gaudi::Functional::FilterPredicate< bool(const In &...), Traits_ >::execute
StatusCode execute() override final
Definition: FilterPredicate.h:25
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:433
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
FunctionalUtilities.h
std::tuple
Gaudi::Functional::details::as_const
constexpr std::add_const_t< T > & as_const(T &t) noexcept
Definition: FunctionalDetails.h:104
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::FilterPredicate< bool(const In &...), Traits_ >::invoke
StatusCode invoke(std::index_sequence< I... >)
Definition: FilterPredicate.h:33
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
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