The Gaudi Framework  master (37c0b60a)
bug34121_Tool.cpp
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 // Framework include files
13 #include <GaudiKernel/MsgStream.h>
14 
15 #include "../AlgTools/IMyTool.h"
16 #include <GaudiKernel/AlgTool.h>
17 
18 // Accessing data:
20 
21 namespace bug_34121 { // see https://its.cern.ch/jira/browse/GAUDI-200
22 
23  // Tool example
24  class Tool : public extends<AlgTool, IMyTool> {
25  public:
27  using extends::extends;
28 
30  const std::string& message() const override;
31  void doIt() const override;
33  StatusCode initialize() override;
34  StatusCode finalize() override;
35 
36  private:
38  Gaudi::Property<double> m_double{ this, "Double", 100. };
39  };
40 
41  //------------------------------------------------------------------------------
42  const std::string& Tool::message() const
43  //------------------------------------------------------------------------------
44  {
45  static const std::string msg( "It works!!!" );
46  return msg;
47  }
48 
49  //------------------------------------------------------------------------------
50  void Tool::doIt() const
51  //------------------------------------------------------------------------------
52  {
53  info() << "Double = " << m_double.value() << endmsg;
54  }
55 
56  //------------------------------------------------------------------------------
58  //------------------------------------------------------------------------------
59  {
60  info() << "Initialize" << endmsg;
61  info() << "Double = " << m_double.value() << endmsg;
62  return StatusCode::SUCCESS;
63  }
64  //------------------------------------------------------------------------------
66  //------------------------------------------------------------------------------
67  {
68  info() << "Finalize" << endmsg;
69  return StatusCode::SUCCESS;
70  }
71 
72  // Declaration of the AlgTool Factory
74 } // namespace bug_34121
bug_34121::Tool::m_double
Gaudi::Property< double > m_double
Properties.
Definition: bug34121_Tool.cpp:38
bug_34121::Tool
Definition: bug34121_Tool.cpp:24
std::string
STL class.
GaudiException.h
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:19
PhysicalConstants.h
bug_34121::Tool::message
const std::string & message() const override
IMyTool interface.
Definition: bug34121_Tool.cpp:42
StatusCode
Definition: StatusCode.h:65
Gaudi::Property::value
const ValueType & value() const
Definition: Property.h:237
bug_34121::Tool::doIt
void doIt() const override
Definition: bug34121_Tool.cpp:50
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
bug_34121::Tool::finalize
StatusCode finalize() override
Definition: bug34121_Tool.cpp:65
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
AlgTool.h
bug_34121::Tool::initialize
StatusCode initialize() override
Overriding initialize and finalize.
Definition: bug34121_Tool.cpp:57
Gaudi::Property< double >
MsgStream.h
bug_34121
Definition: bug_34121.py:1