ATLAS Offline Software
UnitTestTool1A.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 
9 //
10 // includes
11 //
12 
14 
15 //
16 // method implementations
17 //
18 
19 namespace asg
20 {
22  UnitTestTool1A (const std::string& val_name)
23  : AsgTool (val_name)
24  {
25  declareProperty ("propertyInt", m_propertyInt, "the integer property");
26  declareProperty ("propertyString", m_propertyString, "the string property");
27  declareProperty ("initializeFail", m_initializeFail, "whether initialize should fail");
28  }
29 
30 
31 
33  initialize ()
34  {
35  if (m_initializeFail)
36  {
37  ATH_MSG_ERROR ("tool configured to fail initialize");
38  return StatusCode::FAILURE;
39  }
40  if (m_isInitialized)
41  {
42  ATH_MSG_ERROR ("initialize called twice");
43  return StatusCode::FAILURE;
44  }
45  m_isInitialized = true;
46  return StatusCode::SUCCESS;
47  }
48 
49 
50 
51  std::string UnitTestTool1A ::
52  getPropertyString () const
53  {
54  return m_propertyString;
55  }
56 
57 
58 
60  getPropertyInt () const
61  {
62  return m_propertyInt;
63  }
64 
65 
66 
68  setPropertyInt (int val_property)
69  {
70  m_propertyInt = val_property;
71  }
72 
73 
74 
76  isInitialized () const
77  {
78  return m_isInitialized;
79  }
80 }
asg::UnitTestTool1A::m_initializeFail
bool m_initializeFail
whether initialize should fail
Definition: UnitTestTool1A.h:60
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
asg::UnitTestTool1A::UnitTestTool1A
UnitTestTool1A(const std::string &val_name)
standard constructor
Definition: UnitTestTool1A.cxx:22
asg
Definition: DataHandleTestTool.h:28
asg::UnitTestTool1A::initialize
StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: UnitTestTool1A.cxx:33
asg::UnitTestTool1A::getPropertyInt
virtual int getPropertyInt() const override
get the integer property
Definition: UnitTestTool1A.cxx:60
asg::UnitTestTool1A::isInitialized
virtual bool isInitialized() const override
get whether we have been initialized
Definition: UnitTestTool1A.cxx:76
asg::UnitTestTool1A::getPropertyString
virtual std::string getPropertyString() const override
get the integer property
Definition: UnitTestTool1A.cxx:52
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
UnitTestTool1A.h
asg::UnitTestTool1A::m_propertyInt
int m_propertyInt
the integer property
Definition: UnitTestTool1A.h:56
asg::UnitTestTool1A::m_propertyString
std::string m_propertyString
the string property
Definition: UnitTestTool1A.h:52
asg::UnitTestTool1A::m_isInitialized
bool m_isInitialized
whether initialize has been called
Definition: UnitTestTool1A.h:48
asg::UnitTestTool1A::setPropertyInt
virtual void setPropertyInt(int val_property) override
get the integer property
Definition: UnitTestTool1A.cxx:68