The Gaudi Framework
master (da3d77e1)
Consumer.h
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2024 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
13
#include "
details.h
"
14
#include "
utilities.h
"
15
#include <
GaudiKernel/FunctionalFilterDecision.h
>
16
17
#include <tuple>
18
19
namespace
Gaudi::Functional
{
20
21
namespace
details
{
22
23
template
<
typename
Signature,
typename
Traits_,
bool
isLegacy>
24
struct
Consumer
;
25
26
template
<
typename
... In,
typename
Traits_>
27
struct
Consumer
<void( const In&... ), Traits_,
true
>
28
:
DataHandleMixin
<
std::tuple<>
,
filter_evtcontext<In...>
, Traits_> {
29
using
DataHandleMixin<std::tuple<>
,
filter_evtcontext
<In...>, Traits_>
::DataHandleMixin
;
30
31
// derived classes are NOT allowed to implement execute ...
32
StatusCode
execute
() override final {
33
try
{
34
filter_evtcontext_t<In...>::apply
( *
this
, this->m_inputs );
35
return
FilterDecision::PASSED
;
36
}
catch
(
GaudiException
& e ) {
37
if
( e.
code
().
isFailure
() ) this->error() << e.
tag
() <<
" : "
<< e.
message
() <<
endmsg
;
38
return
e.
code
();
39
}
40
}
41
42
// ... instead, they must implement the following operator
43
virtual
void
operator()
(
const
In&... )
const
= 0;
44
};
45
46
template
<
typename
... In,
typename
Traits_>
47
struct
Consumer
<void( const In&... ), Traits_,
false
>
48
:
DataHandleMixin
<
std::tuple<>
,
filter_evtcontext<In...>
, Traits_> {
49
using
DataHandleMixin<std::tuple<>
,
filter_evtcontext
<In...>, Traits_>
::DataHandleMixin
;
50
51
// derived classes are NOT allowed to implement execute ...
52
StatusCode
execute
(
const
EventContext
&
ctx
)
const
override
final
{
53
try
{
54
filter_evtcontext_t<In...>::apply
( *
this
,
ctx
, this->m_inputs );
55
return
FilterDecision::PASSED
;
56
}
catch
(
GaudiException
& e ) {
57
if
( e.
code
().
isFailure
() ) this->error() << e.
tag
() <<
" : "
<< e.
message
() <<
endmsg
;
58
return
e.
code
();
59
}
60
}
61
62
// ... instead, they must implement the following operator
63
virtual
void
operator()
(
const
In&... )
const
= 0;
64
};
65
66
}
// namespace details
67
68
template
<
typename
Signature,
typename
Traits_ = Traits::useDefaults>
69
using
Consumer
=
details::Consumer<Signature, Traits_, details::isLegacy<Traits_>
>;
70
71
}
// namespace Gaudi::Functional
Gaudi::Functional::details::Consumer< void(const In &...), Traits_, false >::operator()
virtual void operator()(const In &...) const =0
GaudiException
Definition:
GaudiException.h:31
std::tuple
Gaudi::Functional::details::Consumer
Definition:
Consumer.h:24
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition:
GaudiException.h:68
Gaudi::Functional::details::Consumer< void(const In &...), Traits_, false >::execute
StatusCode execute(const EventContext &ctx) const override final
Definition:
Consumer.h:52
GaudiPython.Pythonizations.ctx
ctx
Definition:
Pythonizations.py:578
StatusCode
Definition:
StatusCode.h:65
details
Definition:
AnyDataWrapper.h:19
Gaudi::Functional::details::Consumer< void(const In &...), Traits_, true >::operator()
virtual void operator()(const In &...) const =0
Gaudi::Functional::details::filter_evtcontext_t::apply
static auto apply(const Algorithm &algo, Handles &handles)
Definition:
details.h:472
Gaudi::Functional::FilterDecision::PASSED
@ PASSED
Gaudi::Functional
Definition:
Consumer.h:19
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition:
MsgStream.h:202
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition:
GaudiException.h:77
utilities.h
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition:
GaudiException.h:86
StatusCode::isFailure
bool isFailure() const
Definition:
StatusCode.h:129
EventContext
Definition:
EventContext.h:34
Gaudi::Functional::details::DataHandleMixin
Definition:
details.h:506
Gaudi::Functional::details::Consumer< void(const In &...), Traits_, true >::execute
StatusCode execute() override final
Definition:
Consumer.h:32
details.h
FunctionalFilterDecision.h
Gaudi::Functional::details::filter_evtcontext
typename filter_evtcontext_t< In... >::type filter_evtcontext
Definition:
details.h:503
GaudiFunctional
include
Gaudi
Functional
Consumer.h
Generated on Mon Feb 24 2025 11:10:43 for The Gaudi Framework by
1.8.18