The Gaudi Framework  master (53dee381)
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>
16#include <string>
17#include <vector>
18
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
42
43 struct StrDataConsumer final : Gaudi::Functional::Consumer<void( std::string const& ),
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& ),
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
67 : Gaudi::Functional::Consumer<void( Gaudi::TestSuite::Counter const& ),
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
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
#define DECLARE_COMPONENT(type)
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:87
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition ISvcLocator.h:42
details::Consumer< Signature, Traits_, details::isLegacy< Traits_ > > Consumer
Definition Consumer.h:47
Gaudi::Functional::Traits::BaseClass_t< Gaudi::Algorithm > BaseClass_t
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1
NTuple name space.
Definition INTupleSvc.h:16
STL namespace.
void operator()(Gaudi::TestSuite::Counter const &value) const override
CounterDataConsumer(const std::string &name, ISvcLocator *svcLoc)
void operator()(float const &value) const override
FloatDataConsumer(const std::string &name, ISvcLocator *svcLoc)
void operator()(std::vector< int > const &value) const override
IntVectorDataConsumer(const std::string &name, ISvcLocator *svcLoc)
void operator()(std::string const &value) const override
StrDataConsumer(const std::string &name, ISvcLocator *svcLoc)
StructDataConsumer(const std::string &name, ISvcLocator *svcLoc)
void operator()(Gaudi::TestSuite::NTuple::MyStruct const &value) const override