ATLAS Offline Software
Loading...
Searching...
No Matches
AlgB.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "AlgB.h"
8
9#include <memory>
10
11AlgB::AlgB( const std::string& name,
12 ISvcLocator* pSvcLocator ) :
13 ::AthAlgorithm( name, pSvcLocator )
14{
15}
16
17StatusCode AlgB::initialize() {
18 ATH_MSG_DEBUG("initialize " << name());
19
20 ATH_CHECK( m_rdh1.initialize() );
21 ATH_CHECK( m_wrh1.initialize() );
22
23 return StatusCode::SUCCESS;
24}
25
26StatusCode AlgB::execute() {
27 ATH_MSG_DEBUG("execute " << name());
28
30 if (!rh1.isValid()) {
31 ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << m_rdh1.key());
32 return StatusCode::FAILURE;
33 }
34
35 ATH_MSG_INFO(" read: " << rh1.key() << " = " << rh1->val() );
36
38 ATH_CHECK( wh1.record( std::make_unique< HiveDataObj >
39 ( 3300 + rh1->val() ) ) );
40
41 ATH_MSG_INFO(" write: " << wh1.key() << " = " << wh1->val() );
42 ATH_CHECK(wh1.isValid());
43
44 return StatusCode::SUCCESS;
45
46}
47
#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)
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition AlgB.h:27
virtual StatusCode initialize() override
Definition AlgB.cxx:17
virtual StatusCode execute() override
Definition AlgB.cxx:26
AlgB(const std::string &name, ISvcLocator *pSvcLocator)
Definition AlgB.cxx:11
SG::WriteHandleKey< HiveDataObj > m_wrh1
Definition AlgB.h:28
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
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.
virtual bool isValid() override final
Can the handle be successfully dereferenced?