The Gaudi Framework  v36r16 (ea80daf8)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
MyTool.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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 //------------------------------------------------------------------------------
41 //------------------------------------------------------------------------------
42 {
43  info() << "intialize() has been called" << endmsg;
44 
45  info() << "Int = " << m_int.value() << endmsg;
46  info() << "Double = " << m_double.value() << endmsg;
47  info() << "String = " << m_string.value() << endmsg;
48  info() << "Bool = " << m_bool.value() << endmsg;
49 
50  return StatusCode::SUCCESS;
51 }
52 //------------------------------------------------------------------------------
54 //------------------------------------------------------------------------------
55 {
56  info() << "finalize() has been called" << endmsg;
57  return StatusCode::SUCCESS;
58 }
59 
60 //------------------------------------------------------------------------------
62 //------------------------------------------------------------------------------
63 {
64  // to not print messages if we are created in genconf
65  const std::string cmd = System::cmdLineArgs()[0];
66  if ( cmd.find( "genconf" ) != std::string::npos ) return;
67 
68  info() << "destructor has been called" << endmsg;
69 }
MyTool::initialize
StatusCode initialize() override
Overriding initialize and finalize.
Definition: MyTool.cpp:40
GaudiHive.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
PhysicalConstants.h
MyTool::~MyTool
~MyTool() override
Standard destructor.
Definition: MyTool.cpp:61
MyTool.h
MyTool::finalize
StatusCode finalize() override
Definition: MyTool.cpp:53
MyTool::m_int
Gaudi::Property< int > m_int
Properties.
Definition: MyTool.h:42
StatusCode
Definition: StatusCode.h:65
MyTool
Definition: MyTool.h:24
Gaudi::Property::value
const ValueType & value() const
Definition: Property.h:239
MyTool::m_double
Gaudi::Property< double > m_double
Definition: MyTool.h:43
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:203
MyTool::m_string
Gaudi::Property< std::string > m_string
Definition: MyTool.h:44
MyTool::doIt
void doIt() const override
Definition: MyTool.cpp:32
MyTool::m_bool
Gaudi::Property< bool > m_bool
Definition: MyTool.h:45
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:363