The Gaudi Framework
master (53dee381)
Toggle main menu visibility
Loading...
Searching...
No Matches
NTupleReaderConsumers.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 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
#include <
Gaudi/Algorithm.h
>
12
#include <
Gaudi/Functional/Consumer.h
>
13
#include <
Gaudi/TestSuite/NTuple/MyStruct.h
>
14
#include <
GaudiKernel/MsgStream.h
>
15
#include <
GaudiTestSuite/Counter.h
>
16
#include <string>
17
#include <vector>
18
19
namespace
Gaudi::TestSuite::NTuple
{
20
struct
IntVectorDataConsumer
final
21
:
Gaudi::Functional::Consumer
<void( std::vector<int> const& ),
22
Gaudi::Functional::Traits::BaseClass_t<Gaudi::Algorithm>> {
23
IntVectorDataConsumer
(
const
std::string& name,
ISvcLocator
* svcLoc )
24
: Consumer( name, svcLoc, {
"InputLocation"
,
"MyVector"
} ) {}
25
26
void
operator()
( std::vector<int>
const
& value )
const override
{
27
info() <<
"Received vector: "
<< value <<
endmsg
;
28
}
29
};
30
31
DECLARE_COMPONENT
( IntVectorDataConsumer )
32
33
struct
FloatDataConsumer
final
34
:
Gaudi
::
Functional
::Consumer<
void
(
float
const& ),
Gaudi
::
Functional
::Traits::
BaseClass_t
<
Gaudi
::
Algorithm
>> {
35
FloatDataConsumer
(
const
std::string& name,
ISvcLocator
* svcLoc )
36
: Consumer( name, svcLoc, {
"InputLocation"
,
"MyFloat"
} ) {}
37
38
void
operator()
(
float
const
& value )
const override
{ info() <<
"Received float: "
<< value <<
endmsg
; }
39
};
40
41
DECLARE_COMPONENT
(
FloatDataConsumer
)
42
43
struct
StrDataConsumer
final :
Gaudi
::
Functional
::Consumer<
void
(
std
::
string
const& ),
44
Gaudi
::
Functional
::Traits::
BaseClass_t
<
Gaudi
::
Algorithm
>> {
45
StrDataConsumer
(
const
std::string& name,
ISvcLocator
* svcLoc )
46
: Consumer( name, svcLoc, {
"InputLocation"
,
"MyString"
} ) {}
47
48
void
operator()
( std::string
const
& value )
const override
{ info() <<
"Received string: "
<< value <<
endmsg
; }
49
};
50
51
DECLARE_COMPONENT
( StrDataConsumer )
52
53
struct
StructDataConsumer
final
54
:
Gaudi
::
Functional
::Consumer<
void
(
Gaudi
::
TestSuite
::
NTuple
::
MyStruct
const& ),
55
Gaudi
::
Functional
::Traits::
BaseClass_t
<
Gaudi
::
Algorithm
>> {
56
StructDataConsumer
(
const
std::string& name,
ISvcLocator
* svcLoc )
57
: Consumer( name, svcLoc, {
"InputLocation"
,
"MyStruct"
} ) {}
58
59
void
operator()
(
Gaudi::TestSuite::NTuple::MyStruct
const
& value )
const override
{
60
info() <<
"Received struct: MyStruct { id: "
<< value.
id
<<
", name: "
<< value.
name
<<
" }"
<<
endmsg
;
61
}
62
};
63
64
DECLARE_COMPONENT
( StructDataConsumer )
65
66
struct
CounterDataConsumer
final
67
:
Gaudi
::
Functional
::Consumer<
void
(
Gaudi
::
TestSuite
::
Counter
const& ),
68
Gaudi
::
Functional
::Traits::
BaseClass_t
<
Gaudi
::
Algorithm
>> {
69
CounterDataConsumer
(
const
std::string& name,
ISvcLocator
* svcLoc )
70
: Consumer( name, svcLoc, {
"InputLocation"
,
"MyCounter"
} ) {}
71
72
void
operator()
(
Gaudi::TestSuite::Counter
const
& value )
const override
{
73
info() <<
"Received counter: "
<< value <<
endmsg
;
74
}
75
};
76
DECLARE_COMPONENT
( CounterDataConsumer )
77
78
}
// namespace Gaudi::TestSuite::NTuple
Consumer.h
Counter.h
Algorithm.h
MsgStream.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition
MsgStream.h:198
MyStruct.h
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition
PluginServiceV1.h:45
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition
Algorithm.h:87
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition
ISvcLocator.h:42
Gaudi::Functional
Definition
Consumer.h:15
Gaudi::Functional::Consumer
details::Consumer< Signature, Traits_, details::isLegacy< Traits_ > > Consumer
Definition
Consumer.h:47
Gaudi::TestSuite::Counter
Definition
CounterHistos.cpp:23
Gaudi::TestSuite::NTuple
Definition
MyStruct.h:15
Gaudi::TestSuite
Definition
ConditionAccessorHolder.h:21
Gaudi::TestSuite::BaseClass_t
Gaudi::Functional::Traits::BaseClass_t< Gaudi::Algorithm > BaseClass_t
Definition
MakeAndConsume.cpp:63
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition
__init__.py:1
NTuple
NTuple name space.
Definition
INTupleSvc.h:16
std
STL namespace.
Gaudi::TestSuite::FloatDataConsumer
Definition
MakeAndConsume.cpp:292
Gaudi::TestSuite::NTuple::CounterDataConsumer::operator()
void operator()(Gaudi::TestSuite::Counter const &value) const override
Definition
NTupleReaderConsumers.cpp:72
Gaudi::TestSuite::NTuple::CounterDataConsumer::CounterDataConsumer
CounterDataConsumer(const std::string &name, ISvcLocator *svcLoc)
Definition
NTupleReaderConsumers.cpp:69
Gaudi::TestSuite::NTuple::FloatDataConsumer::operator()
void operator()(float const &value) const override
Definition
NTupleReaderConsumers.cpp:38
Gaudi::TestSuite::NTuple::FloatDataConsumer::FloatDataConsumer
FloatDataConsumer(const std::string &name, ISvcLocator *svcLoc)
Definition
NTupleReaderConsumers.cpp:35
Gaudi::TestSuite::NTuple::IntVectorDataConsumer::operator()
void operator()(std::vector< int > const &value) const override
Definition
NTupleReaderConsumers.cpp:26
Gaudi::TestSuite::NTuple::IntVectorDataConsumer::IntVectorDataConsumer
IntVectorDataConsumer(const std::string &name, ISvcLocator *svcLoc)
Definition
NTupleReaderConsumers.cpp:23
Gaudi::TestSuite::NTuple::MyStruct
Definition
MyStruct.h:16
Gaudi::TestSuite::NTuple::MyStruct::id
int id
Definition
MyStruct.h:17
Gaudi::TestSuite::NTuple::MyStruct::name
std::string name
Definition
MyStruct.h:18
Gaudi::TestSuite::NTuple::StrDataConsumer::operator()
void operator()(std::string const &value) const override
Definition
NTupleReaderConsumers.cpp:48
Gaudi::TestSuite::NTuple::StrDataConsumer::StrDataConsumer
StrDataConsumer(const std::string &name, ISvcLocator *svcLoc)
Definition
NTupleReaderConsumers.cpp:45
Gaudi::TestSuite::NTuple::StructDataConsumer::StructDataConsumer
StructDataConsumer(const std::string &name, ISvcLocator *svcLoc)
Definition
NTupleReaderConsumers.cpp:56
Gaudi::TestSuite::NTuple::StructDataConsumer::operator()
void operator()(Gaudi::TestSuite::NTuple::MyStruct const &value) const override
Definition
NTupleReaderConsumers.cpp:59
GaudiTestSuite
src
NTuple
NTupleReaderConsumers.cpp
Generated on
for The Gaudi Framework by
1.17.0