The Gaudi Framework  master (181af51f)
Loading...
Searching...
No Matches
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
14
15#include "../AlgTools/IMyTool.h"
16#include <GaudiKernel/AlgTool.h>
17
18// Accessing data:
20
21namespace 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;
63 }
64 //------------------------------------------------------------------------------
66 //------------------------------------------------------------------------------
67 {
68 info() << "Finalize" << endmsg;
70 }
71
72 // Declaration of the AlgTool Factory
74} // namespace bug_34121
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
#define DECLARE_COMPONENT(type)
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Implementation of property with value of concrete type.
Definition PropertyFwd.h:27
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
constexpr static const auto SUCCESS
Definition StatusCode.h:99
Gaudi::Property< double > m_double
Properties.
StatusCode finalize() override
void doIt() const override
StatusCode initialize() override
Overriding initialize and finalize.
const std::string & message() const override
IMyTool interface.
Base class used to extend a class implementing other interfaces.
Definition extends.h:19