ATLAS Offline Software
Loading...
Searching...
No Matches
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
11HiveAlgL1::HiveAlgL1( const std::string& name,
12 ISvcLocator* pSvcLocator ) :
13 ::HiveAlgBase( name, pSvcLocator )
14{}
15
17
19 ATH_MSG_DEBUG("initialize " << name());
20
21 ATH_CHECK( m_rdh1.initialize() );
22 ATH_CHECK( m_wrh1.initialize() );
23
25}
26
27StatusCode HiveAlgL1::finalize() {
28 ATH_MSG_DEBUG("finalize " << name());
29 return StatusCode::SUCCESS;
30}
31
32StatusCode HiveAlgL1::execute() {
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
unsigned int sleep()
HiveAlgBase(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize() override
StatusCode execute()
Definition HiveAlgL1.cxx:32
SG::WriteHandleKey< HiveDataObj > m_wrh1
Definition HiveAlgL1.h:33
StatusCode finalize()
Definition HiveAlgL1.cxx:27
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition HiveAlgL1.h:32
HiveAlgL1(const std::string &name, ISvcLocator *pSvcLocator)
Definition HiveAlgL1.cxx:11
StatusCode initialize()
Definition HiveAlgL1.cxx:18
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.