ATLAS Offline Software
AsgHelloTool.cxx
Go to the documentation of this file.
1 // AsgHelloTool.cxx
2 
4 
5 //**********************************************************************
6 
8 AsgHelloTool( const std::string& myname )
9 : AsgTool(myname) {
10  declareProperty("Message", m_msg);
11 }
12 
13 //**********************************************************************
14 
16 
17  ATH_MSG_VERBOSE( "Initialising tool " << name() );
18 
19  return StatusCode::SUCCESS;
20 }
21 
22 //**********************************************************************
23 
24 int AsgHelloTool::talk() const {
25  ATH_MSG_DEBUG("Talking...");
27  // Create and execute a temporary tool.
28  if ( name() != "tmphello" ) {
29  AsgHelloTool tmptool("tmphello");
30  if( ! tmptool.setProperty("Message", "Hi from the temporary tool.").isSuccess() ) {
31  ATH_MSG_ERROR( "Failed to set property on temporary tool" );
32  return 1;
33  }
34  tmptool.talk();
35  }
36  return 0;
37 }
38 //**********************************************************************
39 
40 void AsgHelloTool::print() const {
42  ATH_MSG_INFO(" Message: \"" << m_msg << "\"");
43  ATH_MSG_INFO(" MsgLevel: " << MSG::name( msg().currentLevel() ) );
44  ATH_MSG_ALWAYS("This message always appears.");
45 }
46 
47 //**********************************************************************
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AsgHelloTool::m_msg
std::string m_msg
Definition: AsgHelloTool.h:33
AsgHelloTool.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AsgHelloTool::print
virtual void print() const
Print the state of the tool.
Definition: AsgHelloTool.cxx:40
AsgHelloTool::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: AsgHelloTool.cxx:15
ATH_MSG_ALWAYS
#define ATH_MSG_ALWAYS(x)
Definition: AthMsgStreamMacros.h:35
MSG::name
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition: MsgLevel.cxx:19
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
AsgHelloTool
Definition: AsgHelloTool.h:17
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
AsgHelloTool::AsgHelloTool
AsgHelloTool(const std::string &myname)
Definition: AsgHelloTool.cxx:8
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
AsgHelloTool::talk
virtual int talk() const
Definition: AsgHelloTool.cxx:24