ATLAS Offline Software
HiveAlgL1.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 "HiveAlgL1.h"
6 #include "GaudiKernel/ServiceHandle.h"
7 #include <thread>
8 #include <chrono>
9 #include <memory>
10 
11 HiveAlgL1::HiveAlgL1( const std::string& name,
12  ISvcLocator* pSvcLocator ) :
13  ::HiveAlgBase( name, pSvcLocator )
14 {}
15 
17 
19  ATH_MSG_DEBUG("initialize " << name());
20 
23 
24  return HiveAlgBase::initialize();
25 }
26 
28  ATH_MSG_DEBUG("finalize " << name());
29  return StatusCode::SUCCESS;
30 }
31 
33 
34  ATH_MSG_DEBUG("execute " << name());
35 
36  sleep();
37 
39  if (!rdh1.isValid()) {
40  ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << rdh1.key());
41  return StatusCode::FAILURE;
42  }
43 
44  ATH_MSG_INFO(" read: " << rdh1.key() << " = " << rdh1->val() );
45 
47  ATH_CHECK(wrh1.record(std::make_unique< HiveDataObj >(rdh1->val()+1)));
48 
49  ATH_MSG_INFO(" write: " << wrh1.key() << " = " << wrh1->val() );
50 
51  return StatusCode::SUCCESS;
52 
53 }
54 
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
HiveAlgBase::sleep
unsigned int sleep()
Definition: HiveAlgBase.cxx:42
HiveAlgL1::initialize
StatusCode initialize()
Definition: HiveAlgL1.cxx:18
HiveAlgBase::initialize
virtual StatusCode initialize() override
Definition: HiveAlgBase.cxx:25
HiveAlgL1::HiveAlgL1
HiveAlgL1(const std::string &name, ISvcLocator *pSvcLocator)
Definition: HiveAlgL1.cxx:11
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
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
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
HiveAlgL1::finalize
StatusCode finalize()
Definition: HiveAlgL1.cxx:27
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
HiveAlgL1::execute
StatusCode execute()
Definition: HiveAlgL1.cxx:32
HiveAlgL1::m_rdh1
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition: HiveAlgL1.h:32
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
HiveAlgL1::~HiveAlgL1
~HiveAlgL1()
Definition: HiveAlgL1.cxx:16
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
HiveAlgL1.h
HiveAlgL1::m_wrh1
SG::WriteHandleKey< HiveDataObj > m_wrh1
Definition: HiveAlgL1.h:33
HiveDataObj::val
void val(int i)
Definition: HiveDataObj.h:22