ATLAS Offline Software
HiveAlgD.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 #include "HiveAlgD.h"
6 
7 HiveAlgD::HiveAlgD( const std::string& name,
8  ISvcLocator* pSvcLocator ) :
9  ::HiveAlgBase( name, pSvcLocator )
10 {
11 }
12 
13 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
18  ATH_MSG_DEBUG("initialize " << name());
19 
22 
23  // initialize base class
24  return HiveAlgBase::initialize();
25 }
26 
27 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
29  ATH_MSG_DEBUG("finalize " << name());
30  return StatusCode::SUCCESS;
31 }
32 
33 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
35 
36  ATH_MSG_DEBUG("execute " << name());
37 
38  sleep();
39 
41  if (!rdh1.isValid()) {
42  ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << rdh1.key());
43  return StatusCode::FAILURE;
44  }
45 
46  ATH_MSG_INFO(" read: " << rdh1.key() << " = " << rdh1->val() );
47 
49  ATH_CHECK(wrh1.record(std::make_unique< HiveDataObj >(40000)));
50 
51  ATH_MSG_INFO(" write: " << wrh1.key() << " = " << wrh1->val() );
52 
53  return StatusCode::SUCCESS;
54 
55 }
56 
HiveAlgD.h
Simple Algorithm that reads one HiveDataObj created by HiveAlgA, and writes out one object.
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
HiveAlgD::m_rdh1
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition: HiveAlgD.h:39
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
HiveAlgBase::sleep
unsigned int sleep()
Definition: HiveAlgBase.cxx:42
HiveAlgD::HiveAlgD
HiveAlgD(const std::string &name, ISvcLocator *pSvcLocator)
Definition: HiveAlgD.cxx:7
HiveAlgD::finalize
virtual StatusCode finalize() override
Definition: HiveAlgD.cxx:28
HiveAlgBase::initialize
virtual StatusCode initialize() override
Definition: HiveAlgBase.cxx:25
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
HiveAlgD::~HiveAlgD
~HiveAlgD()
Definition: HiveAlgD.cxx:14
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
HiveAlgBase
Definition: HiveAlgBase.h:26
HiveAlgD::execute
virtual StatusCode execute() override
Definition: HiveAlgD.cxx:34
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
HiveAlgD::initialize
virtual StatusCode initialize() override
Definition: HiveAlgD.cxx:17
SG::VarHandleBase::key
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:64
HiveAlgD::m_wrh1
SG::WriteHandleKey< HiveDataObj > m_wrh1
Definition: HiveAlgD.h:41
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
HiveDataObj::val
void val(int i)
Definition: HiveDataObj.h:22