The Gaudi Framework  master (37c0b60a)
MyTool.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 
14 // Accessing data:
16 
17 // Tool example
18 #include "MyTool.h"
19 
20 // Declaration of the AlgTool Factory
22 
23 //------------------------------------------------------------------------------
24 const std::string& MyTool::message() const
25 //------------------------------------------------------------------------------
26 {
27  static std::string msg( "It works!!!" );
28  return msg;
29 }
30 
31 //------------------------------------------------------------------------------
32 void MyTool::doIt() const
33 //------------------------------------------------------------------------------
34 {
35  info() << "doIt() has been called" << endmsg;
36  debug() << "doIt() [DEBUG] has been called" << endmsg;
37 }
38 
39 //------------------------------------------------------------------------------
40 void MyTool::doItAgain() const
41 //------------------------------------------------------------------------------
42 {
43  info() << "doItAgain() has been called" << endmsg;
44 }
45 
46 //------------------------------------------------------------------------------
48 //------------------------------------------------------------------------------
49 {
50  info() << "intialize() has been called" << endmsg;
51 
52  info() << "Int = " << m_int.value() << endmsg;
53  info() << "Double = " << m_double.value() << endmsg;
54  info() << "String = " << m_string.value() << endmsg;
55  info() << "Bool = " << m_bool.value() << endmsg;
56 
57  return StatusCode::SUCCESS;
58 }
59 //------------------------------------------------------------------------------
61 //------------------------------------------------------------------------------
62 {
63  info() << "finalize() has been called" << endmsg;
64  return StatusCode::SUCCESS;
65 }
66 
67 //------------------------------------------------------------------------------
69 //------------------------------------------------------------------------------
70 {
71  // to not print messages if we are created in genconf
72  const std::string cmd = System::cmdLineArgs()[0];
73  if ( cmd.find( "genconf" ) != std::string::npos ) return;
74 
75  info() << "destructor has been called" << endmsg;
76 }
MyTool::initialize
StatusCode initialize() override
Overriding initialize and finalize.
Definition: MyTool.cpp:47
precedence.message
message
Definition: precedence.py:19
std::string
STL class.
GaudiException.h
std::string::find
T find(T... args)
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:19
MyTool::doItAgain
void doItAgain() const override
Definition: MyTool.cpp:40
PhysicalConstants.h
MyTool::~MyTool
~MyTool() override
Standard destructor.
Definition: MyTool.cpp:68
MyTool.h
MyTool::finalize
StatusCode finalize() override
Definition: MyTool.cpp:60
MyTool::m_int
Gaudi::Property< int > m_int
Properties.
Definition: MyTool.h:44
StatusCode
Definition: StatusCode.h:65
MyTool
Definition: MyTool.h:24
Gaudi::Property::value
const ValueType & value() const
Definition: Property.h:237
MyTool::m_double
Gaudi::Property< double > m_double
Definition: MyTool.h:45
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
MyTool::m_string
Gaudi::Property< std::string > m_string
Definition: MyTool.h:46
MyTool::doIt
void doIt() const override
Definition: MyTool.cpp:32
MyTool::m_bool
Gaudi::Property< bool > m_bool
Definition: MyTool.h:47
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
std
STL namespace.
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
System::cmdLineArgs
GAUDI_API const std::vector< std::string > cmdLineArgs()
Command line arguments including executable name as arg[0] as vector of strings.
Definition: System.cpp:365