The Gaudi Framework  master (37c0b60a)
Algorithms.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2023 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 "FloatTool.h"
14 #include <GaudiKernel/MsgStream.h>
15 
16 namespace Gaudi {
17  namespace TestSuite {
19 
20  struct THDataProducer : Gaudi::Functional::Producer<int(), BaseClass_t> {
21 
23  : Producer( name, svcLoc, KeyValue( "OutputLocation", "/Event/MyInt" ) ) {}
24 
25  int operator()() const override {
26  info() << "executing IntDataProducer, storing 7 into " << outputLocation() << endmsg;
27  return 7;
28  }
29  };
30 
31  DECLARE_COMPONENT( THDataProducer )
32 
33  struct THDataProducer2 : Gaudi::Functional::Producer<float(), BaseClass_t> {
34 
36  : Producer( name, svcLoc, KeyValue( "OutputLocation", "/Event/MyFloat" ) ) {}
37 
38  float operator()() const override {
39  info() << "executing IntDataProducer, storing 7.0 into " << outputLocation() << endmsg;
40  return 7.0;
41  }
42  };
43 
44  DECLARE_COMPONENT( THDataProducer2 )
45 
46  struct THDataConsumer : Gaudi::Functional::Consumer<void( const int& ), BaseClass_t> {
47 
49  : Consumer( name, svcLoc, KeyValue( "InputLocation", "/Event/MyInt" ) ) {}
50 
51  void operator()( const int& input ) const override {
52  info() << "executing IntDataConsumer, checking " << input << " from " << inputLocation() << " and "
53  << m_floatTool->getFloat() << " from FloatTool are matching" << endmsg;
54  }
55 
56  ToolHandle<FloatTool> m_floatTool{ this, "FloatTool", "Gaudi::TestSuite::FloatTool" };
57  };
58 
59  DECLARE_COMPONENT( THDataConsumer )
60  } // namespace TestSuite
61 } // namespace Gaudi
62 
63 namespace Gaudi::Examples {
66  };
68 } // namespace Gaudi::Examples
Gaudi::Functional::Consumer
details::Consumer< Signature, Traits_, details::isLegacy< Traits_ > > Consumer
Definition: Consumer.h:69
std::string
STL class.
Gaudi::TestSuite::THDataProducer2::THDataProducer2
THDataProducer2(const std::string &name, ISvcLocator *svcLoc)
Definition: Algorithms.cpp:35
TestSuite
#define TestSuite
Definition: MakeAndConsume.cpp:658
ISvcLocator
Definition: ISvcLocator.h:46
Gaudi::TestSuite::THDataProducer::operator()
int operator()() const override
Definition: Algorithms.cpp:25
Gaudi::TestSuite::THDataProducer2
Definition: Algorithms.cpp:33
Gaudi::TestSuite::THDataConsumer::operator()
void operator()(const int &input) const override
Definition: Algorithms.cpp:51
ToolHandle
Definition: ToolHandle.h:132
Gaudi::Examples
Definition: Collision.h:20
Consumer.h
Gaudi::TestSuite::THDataConsumer
Definition: Algorithms.cpp:46
Gaudi::Functional::Producer
details::Producer< Signature, Traits_, details::isLegacy< Traits_ > > Producer
Definition: Producer.h:37
Producer.h
FloatTool.h
Gaudi::Functional::details::Producer
Definition: Producer.h:22
Gaudi::TestSuite::THDataProducer2::operator()
float operator()() const override
Definition: Algorithms.cpp:38
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
Gaudi::Functional::Traits::BaseClass_t
Definition: utilities.h:38
Gaudi::TestSuite::THDataConsumer::THDataConsumer
THDataConsumer(const std::string &name, ISvcLocator *svcLoc)
Definition: Algorithms.cpp:48
Gaudi::Examples::THDataConsumer
Definition: Algorithms.cpp:64
Gaudi::TestSuite::THDataProducer
Definition: Algorithms.cpp:20
Gaudi::TestSuite::THDataProducer::THDataProducer
THDataProducer(const std::string &name, ISvcLocator *svcLoc)
Definition: Algorithms.cpp:22
MsgStream.h