The Gaudi Framework
master (1a7a3838)
Toggle main menu visibility
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
12
#include <
GaudiKernel/GaudiException.h
>
13
14
// Accessing data:
15
#include <
GaudiKernel/PhysicalConstants.h
>
16
17
// Tool example
18
#include "
MyTool.h
"
19
20
// Declaration of the AlgTool Factory
21
DECLARE_COMPONENT
(
MyTool
)
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
//------------------------------------------------------------------------------
47
StatusCode
MyTool::initialize
()
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
//------------------------------------------------------------------------------
60
StatusCode
MyTool::finalize
()
61
//------------------------------------------------------------------------------
62
{
63
info
() <<
"finalize() has been called"
<<
endmsg
;
64
return
StatusCode::SUCCESS
;
65
}
66
67
//------------------------------------------------------------------------------
68
MyTool::~MyTool
()
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
}
GaudiException.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition
MsgStream.h:198
MyTool.h
PhysicalConstants.h
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition
PluginServiceV1.h:45
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition
CommonMessaging.h:118
CommonMessagingBase::msg
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
Definition
CommonMessaging.h:124
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition
CommonMessaging.h:115
MyTool
This is an interface class for a example tool.
Definition
MyTool.h:23
MyTool::~MyTool
~MyTool() override
Standard destructor.
Definition
MyTool.cpp:68
MyTool::initialize
StatusCode initialize() override
Overriding initialize and finalize.
Definition
MyTool.cpp:47
MyTool::message
const std::string & message() const override
IMyTool interface.
Definition
MyTool.cpp:24
MyTool::doItAgain
void doItAgain() const override
Definition
MyTool.cpp:40
MyTool::doIt
void doIt() const override
Definition
MyTool.cpp:32
MyTool::m_string
Gaudi::Property< std::string > m_string
Definition
MyTool.h:45
MyTool::m_double
Gaudi::Property< double > m_double
Definition
MyTool.h:44
MyTool::finalize
StatusCode finalize() override
Definition
MyTool.cpp:60
MyTool::m_int
Gaudi::Property< int > m_int
Properties.
Definition
MyTool.h:43
MyTool::m_bool
Gaudi::Property< bool > m_bool
Definition
MyTool.h:46
StatusCode
This class is used for returning status codes from appropriate routines.
Definition
StatusCode.h:64
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition
StatusCode.h:99
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:295
std
STL namespace.
GaudiTestSuite
src
AlgTools
MyTool.cpp
Generated on
for The Gaudi Framework by
1.17.0