The Gaudi Framework  v41r0 (bdbe7744)
Loading...
Searching...
No Matches
FilterPredicate.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2026 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#pragma once
12#include "details.h"
13#include "utilities.h"
14
15namespace Gaudi::Functional {
16
17 namespace details {
18
19 template <typename T, typename Traits_, bool isLegacy>
21
22 template <typename... In, typename Traits_, bool isLegacy>
23 StatusCode execute_filter_predicate( const FilterPredicate<bool( const In&... ), Traits_, isLegacy>& algo,
24 const EventContext& ctx ) {
25 return details::execute(
26 algo, [&] { return algo.invoke( algo, ctx ) ? FilterDecision::PASSED : FilterDecision::FAILED; } );
27 }
28
29 template <typename... In, typename Traits_>
30 struct FilterPredicate<bool( const In&... ), Traits_, true>
31 : DataHandleMixin<type_list<>, type_list<In...>, Traits_> {
33
34 // derived classes are NOT allowed to implement execute ...
35 StatusCode execute() override final { return execute_filter_predicate( *this, this->getContext() ); }
36 // ... instead, they must implement the following operator
37 virtual bool operator()( const In&... ) const = 0;
38 };
39
40 template <typename... In, typename Traits_>
41 struct FilterPredicate<bool( const In&... ), Traits_, false>
42 : DataHandleMixin<type_list<>, type_list<In...>, Traits_> {
44
45 // derived classes are NOT allowed to implement execute ...
46 StatusCode execute( const EventContext& ctx ) const override final {
47 return execute_filter_predicate( *this, ctx );
48 }
49
50 // ... instead, they must implement the following operator
51 virtual bool operator()( const In&... ) const = 0;
52 };
53
54 } // namespace details
55
56 template <typename Signature, typename Traits_ = Traits::useDefaults>
58
59} // namespace Gaudi::Functional
This class represents an entry point to all the event specific data.
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
constexpr bool isLegacy
Definition details.h:646
StatusCode execute_filter_predicate(const FilterPredicate< bool(const In &...), Traits_, isLegacy > &algo, const EventContext &ctx)
StatusCode execute(CommonMessagingBase const &alg, F &&f)
Definition details.h:398
details::FilterPredicate< Signature, Traits_, details::isLegacy< Traits_ > > FilterPredicate
StatusCode execute(const EventContext &ctx) const override final