Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v36r7 (7f57a304)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Algorithms.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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"
12 #include <GaudiAlg/Consumer.h>
13 #include <GaudiAlg/Producer.h>
14 #include <GaudiKernel/MsgStream.h>
15 
16 namespace Gaudi {
17  namespace Examples {
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::Examples::FloatTool" };
57  };
58 
59  DECLARE_COMPONENT( THDataConsumer )
60  } // namespace Examples
61 } // namespace Gaudi
Gaudi::Examples::THDataProducer2::THDataProducer2
THDataProducer2(const std::string &name, ISvcLocator *svcLoc)
Definition: Algorithms.cpp:35
Gaudi::Functional::Consumer
details::Consumer< Signature, Traits_, details::isLegacy< Traits_ > > Consumer
Definition: Consumer.h:69
Gaudi::Examples::THDataProducer
Definition: Algorithms.cpp:20
std::string
STL class.
Gaudi::Examples::THDataProducer2::operator()
float operator()() const override
Definition: Algorithms.cpp:38
ISvcLocator
Definition: ISvcLocator.h:46
Gaudi::Examples::THDataProducer::THDataProducer
THDataProducer(const std::string &name, ISvcLocator *svcLoc)
Definition: Algorithms.cpp:22
Gaudi::Examples::THDataConsumer::operator()
void operator()(const int &input) const override
Definition: Algorithms.cpp:51
Gaudi::Examples::THDataProducer::operator()
int operator()() const override
Definition: Algorithms.cpp:25
ToolHandle
Definition: ToolHandle.h:132
Gaudi::Examples::THDataProducer2
Definition: Algorithms.cpp:33
TimingHistograms.name
name
Definition: TimingHistograms.py:25
Consumer.h
Gaudi::Functional::Producer
details::Producer< Signature, Traits_, details::isLegacy< Traits_ > > Producer
Definition: Producer.h:37
Producer.h
Gaudi::Examples::THDataConsumer::THDataConsumer
THDataConsumer(const std::string &name, ISvcLocator *svcLoc)
Definition: Algorithms.cpp:48
FloatTool.h
Gaudi::Functional::details::Producer
Definition: Producer.h:22
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:203
Gaudi
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
Gaudi::Functional::Traits::BaseClass_t
Definition: FunctionalUtilities.h:72
Gaudi::Examples::THDataConsumer
Definition: Algorithms.cpp:46
MsgStream.h