ATLAS Offline Software
HiveAlgL2.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 "HiveAlgL2.h"
6 #include "GaudiKernel/ServiceHandle.h"
7 #include <thread>
8 #include <chrono>
9 #include <memory>
10 
11 HiveAlgL2::HiveAlgL2( const std::string& name,
12  ISvcLocator* pSvcLocator ) :
13  ::HiveAlgBase( name, pSvcLocator )
14  ,m_udh1("l1")
15 {
16 
17  declareProperty("Key_U1",m_udh1);
18 
19 }
20 
22 
24  ATH_MSG_DEBUG("initialize " << name());
25 
28 
29  return HiveAlgBase::initialize();
30 }
31 
33  ATH_MSG_DEBUG("finalize " << name());
34  return StatusCode::SUCCESS;
35 }
36 
38 
39  ATH_MSG_DEBUG("execute " << name());
40 
41  sleep();
42 
44  if (!rdh1.isValid()) {
45  ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << rdh1.key());
46  return StatusCode::FAILURE;
47  }
48 
49  ATH_MSG_INFO(" read: " << rdh1.key() << " = " << rdh1->val() );
50 
52 
53  udh1->val( udh1->val() + 1);
54 
55  // wrh1 = std::make_unique< HiveDataObj >( HiveDataObj(rdh1->val()+1) );
56 
57  ATH_MSG_INFO(" update: " << udh1.key() << " = " << udh1->val() );
58 
59  return StatusCode::SUCCESS;
60 
61 }
62 
HiveAlgL2::finalize
StatusCode finalize()
Definition: HiveAlgL2.cxx:32
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
HiveAlgBase::sleep
unsigned int sleep()
Definition: HiveAlgBase.cxx:42
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
HiveAlgL2::m_rdh1
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition: HiveAlgL2.h:33
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
HiveAlgL2::m_udh1
SG::UpdateHandleKey< HiveDataObj > m_udh1
Definition: HiveAlgL2.h:35
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
HiveAlgL2::HiveAlgL2
HiveAlgL2(const std::string &name, ISvcLocator *pSvcLocator)
Definition: HiveAlgL2.cxx:11
SG::UpdateHandle
Definition: UpdateHandle.h:94
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
HiveDataObj::val
void val(int i)
Definition: HiveDataObj.h:22
HiveAlgL2::~HiveAlgL2
~HiveAlgL2()
Definition: HiveAlgL2.cxx:21
HiveAlgL2::initialize
StatusCode initialize()
Definition: HiveAlgL2.cxx:23
HiveAlgL2::execute
StatusCode execute()
Definition: HiveAlgL2.cxx:37
HiveAlgL2.h