The Gaudi Framework  master (181af51f)
Loading...
Searching...
No Matches
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//------------------------------------------------------------------------------
24const std::string& MyTool::message() const
25//------------------------------------------------------------------------------
26{
27 static std::string msg( "It works!!!" );
28 return msg;
29}
30
31//------------------------------------------------------------------------------
32void MyTool::doIt() const
33//------------------------------------------------------------------------------
34{
35 info() << "doIt() has been called" << endmsg;
36 debug() << "doIt() [DEBUG] has been called" << endmsg;
37}
38
39//------------------------------------------------------------------------------
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
58}
59//------------------------------------------------------------------------------
61//------------------------------------------------------------------------------
62{
63 info() << "finalize() has been called" << endmsg;
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}
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
#define DECLARE_COMPONENT(type)
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
This is an interface class for a example tool.
Definition MyTool.h:23
~MyTool() override
Standard destructor.
Definition MyTool.cpp:68
StatusCode initialize() override
Overriding initialize and finalize.
Definition MyTool.cpp:47
const std::string & message() const override
IMyTool interface.
Definition MyTool.cpp:24
void doItAgain() const override
Definition MyTool.cpp:40
void doIt() const override
Definition MyTool.cpp:32
Gaudi::Property< std::string > m_string
Definition MyTool.h:45
Gaudi::Property< double > m_double
Definition MyTool.h:44
StatusCode finalize() override
Definition MyTool.cpp:60
Gaudi::Property< int > m_int
Properties.
Definition MyTool.h:43
Gaudi::Property< bool > m_bool
Definition MyTool.h:46
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_API const std::vector< std::string > cmdLineArgs()
Command line arguments including executable name as arg[0] as vector of strings.
Definition System.cpp:310
STL namespace.