ATLAS Offline Software
HiveAlgC.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 "HiveAlgC.h"
6 
7 HiveAlgC::HiveAlgC( const std::string& name,
8  ISvcLocator* pSvcLocator ) :
9  ::HiveAlgBase( name, pSvcLocator )
10 {
11 }
12 
13 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
18  ATH_MSG_DEBUG("initialize " << name());
19 
23 
24  // initialize base class
25  return HiveAlgBase::initialize();
26 }
27 
28 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
30  ATH_MSG_DEBUG("finalize " << name());
31  return StatusCode::SUCCESS;
32 }
33 
34 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
36 
37  ATH_MSG_DEBUG("execute " << name());
38 
39  sleep();
40 
42  if (!rdh1.isValid()) {
43  ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << rdh1.key());
44  return StatusCode::FAILURE;
45  }
46 
47  ATH_MSG_INFO(" read: " << rdh1.key() << " = " << rdh1->val() );
48 
50  ATH_CHECK(wrh1.record(std::make_unique< HiveDataObj >(30000 + rdh1->val() )));
51 
53  ATH_CHECK(wrh2.record(std::make_unique< HiveDataObj >(30001)));
54 
55  ATH_MSG_INFO(" write: " << wrh1.key() << " = " << wrh1->val() );
56  ATH_MSG_INFO(" write: " << wrh2.key() << " = " << wrh2->val() );
57 
58  return StatusCode::SUCCESS;
59 
60 }
61 
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
HiveAlgC.h
Simple Algorithm that reads a DataHandle created by HiveAlgA, and writes two more.
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
HiveAlgC::~HiveAlgC
~HiveAlgC()
Definition: HiveAlgC.cxx:14
HiveAlgBase::sleep
unsigned int sleep()
Definition: HiveAlgBase.cxx:42
HiveAlgC::m_rdh1
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition: HiveAlgC.h:39
HiveAlgC::finalize
virtual StatusCode finalize() override
Definition: HiveAlgC.cxx:29
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
HiveAlgC::execute
virtual StatusCode execute() override
Definition: HiveAlgC.cxx:35
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
HiveAlgC::m_wrh1
SG::WriteHandleKey< HiveDataObj > m_wrh1
Definition: HiveAlgC.h:41
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
HiveAlgC::initialize
virtual StatusCode initialize() override
Definition: HiveAlgC.cxx:17
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
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
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.
HiveAlgC::m_wrh2
SG::WriteHandleKey< HiveDataObj > m_wrh2
Definition: HiveAlgC.h:42
HiveDataObj::val
void val(int i)
Definition: HiveDataObj.h:22
HiveAlgC::HiveAlgC
HiveAlgC(const std::string &name, ISvcLocator *pSvcLocator)
Definition: HiveAlgC.cxx:7