ATLAS Offline Software
UnitTestAlg6.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //
6 // includes
7 //
8 
10 
11 //
12 // method implementations
13 //
14 
15 namespace EL
16 {
18  UnitTestAlg6 (const std::string& name, ISvcLocator* pSvcLocator)
19  : AnaReentrantAlgorithm (name, pSvcLocator)
20  {
21  declareProperty ("property", m_property, "test property");
22  declareProperty ("string_property", m_string_property, "test string property");
23  declareProperty ("toolHandle", m_toolHandle, "ToolHandle property");
24  }
25 
26 
27 
29  initialize ()
30  {
31  if (m_wasInitialized)
32  {
33  ANA_MSG_FATAL ("initialized twice");
34  return StatusCode::FAILURE;
35  }
36 
37  if (!m_toolHandle.empty())
38  ANA_CHECK (m_toolHandle.retrieve());
39 
40  m_wasInitialized = true;
41  return ::StatusCode::SUCCESS;
42  }
43 
44 
45 
47  execute (const EventContext& /*ctx*/) const
48  {
49  if (!m_wasInitialized)
50  {
51  ANA_MSG_FATAL ("never initialized");
52  return StatusCode::FAILURE;
53  }
54  return ::StatusCode::SUCCESS;
55  }
56 
57 
58 
60  finalize ()
61  {
62  if (!m_wasInitialized)
63  {
64  ANA_MSG_FATAL ("never initialized");
65  return StatusCode::FAILURE;
66  }
67  return ::StatusCode::SUCCESS;
68  }
69 }
EL::UnitTestAlg6::m_toolHandle
ToolHandle< IUnitTestTool > m_toolHandle
the tool handle property our owner sets
Definition: UnitTestAlg6.h:41
EL::UnitTestAlg6::m_wasInitialized
bool m_wasInitialized
whether initialize has been called
Definition: UnitTestAlg6.h:45
EL::UnitTestAlg6::m_property
float m_property
the float property our owner sets
Definition: UnitTestAlg6.h:33
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
EL::UnitTestAlg6::initialize
virtual ::StatusCode initialize() override
Definition: UnitTestAlg6.cxx:29
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
EL::UnitTestAlg6::finalize
virtual ::StatusCode finalize() override
Definition: UnitTestAlg6.cxx:60
ANA_MSG_FATAL
#define ANA_MSG_FATAL(xmsg)
Macro printing fatal messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:296
EL::UnitTestAlg6::execute
virtual ::StatusCode execute(const EventContext &ctx) const override
Definition: UnitTestAlg6.cxx:47
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
EL::AnaReentrantAlgorithm
the base class for EventLoop reentrant algorithms
Definition: AnaReentrantAlgorithm.h:51
EL::UnitTestAlg6::UnitTestAlg6
UnitTestAlg6(const std::string &name, ISvcLocator *pSvcLocator)
Definition: UnitTestAlg6.cxx:18
EL::UnitTestAlg6::m_string_property
std::string m_string_property
the string property our owner sets
Definition: UnitTestAlg6.h:37
UnitTestAlg6.h