ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthViews
src_dflow
AthViews/src_dflow/DFlowAlg1.cxx
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// DFlowAlg1.cxx
8
// Implementation file for class DFlowAlg1
9
// Modifed by bwynne to add simple tests for views
10
// Author: S.Binet<binet@cern.ch>
12
13
// AthExStoreGateExample includes
14
#include "
DFlowAlg1.h
"
15
16
// STL includes
17
18
// FrameWork includes
19
#include "Gaudi/Property.h"
20
#include "
StoreGate/ReadHandle.h
"
21
#include "
StoreGate/WriteHandle.h
"
22
23
namespace
AthViews
{
24
25
// Athena Algorithm's Hooks
27
StatusCode
DFlowAlg1::initialize
()
28
{
29
ATH_MSG_INFO
(
"Initializing "
<< name() <<
"..."
);
30
31
CHECK
(
m_r_int
.initialize() );
32
CHECK
(
m_w_int
.initialize() );
33
CHECK
(
m_testUpdate
.initialize() );
34
35
return
StatusCode::SUCCESS;
36
}
37
38
StatusCode
DFlowAlg1::finalize
()
39
{
40
ATH_MSG_INFO
(
"Finalizing "
<< name() <<
"..."
);
41
42
return
StatusCode::SUCCESS;
43
}
44
45
StatusCode
DFlowAlg1::execute
(
const
EventContext& ctx)
const
46
{
47
ATH_MSG_DEBUG
(
"Executing "
<< name() <<
"..."
);
48
49
SG::ReadHandle< int >
inputData(
m_r_int
, ctx );
50
if
( !inputData.
isValid
() )
51
{
52
ATH_MSG_ERROR
(
"Failed to retrieve initial view data from store "
<< inputData.
store
() );
53
return
StatusCode::FAILURE;
54
}
55
int
seedData = *inputData;
56
57
SG::WriteHandle< int >
outputData(
m_w_int
, ctx );
58
ATH_MSG_INFO
(
"myint handle..."
);
59
ATH_MSG_INFO
(
"name: ["
<< outputData.
name
() <<
"]"
);
60
ATH_MSG_INFO
(
"store ["
<< outputData.
store
() <<
"]"
);
61
ATH_MSG_INFO
(
"clid: ["
<< outputData.
clid
() <<
"]"
);
62
63
ATH_CHECK
( outputData.
record
( std::make_unique< int >( seedData ) ) );
64
65
//redundant check as op = would throw if outputData was not valid (e.g. because if clid/key combo was duplicated)
66
if
( outputData.
isValid
() )
67
{
68
ATH_MSG_INFO
(
"ptr: "
<< outputData.
cptr
());
69
ATH_MSG_INFO
(
"val: "
<< *outputData);
70
71
ATH_MSG_INFO
(
"modify myint by value..."
);
72
73
ATH_MSG_INFO
(
"ptr: "
<< outputData.
cptr
());
74
ATH_MSG_INFO
(
"val: "
<< *outputData);
75
}
76
77
// Test update handles
78
SG::WriteHandle< HiveDataObj >
testUpdate(
m_testUpdate
, ctx );
79
ATH_CHECK
( testUpdate.
recordNonConst
( std::make_unique< HiveDataObj >( 123 ) ) );
80
ATH_MSG_INFO
(
"Update handle initial: "
<< testUpdate->val() );
81
82
return
StatusCode::SUCCESS;
83
}
84
85
}
//> end namespace AthViews
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
DFlowAlg1.h
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
AthViews::DFlowAlg1::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
AthViews/src_dflow/DFlowAlg1.cxx:45
AthViews::DFlowAlg1::initialize
virtual StatusCode initialize() override
Definition
AthViews/src_dflow/DFlowAlg1.cxx:27
AthViews::DFlowAlg1::m_testUpdate
SG::WriteHandleKey< HiveDataObj > m_testUpdate
Definition
AthViews/src_dflow/DFlowAlg1.h:39
AthViews::DFlowAlg1::finalize
virtual StatusCode finalize() override
Definition
AthViews/src_dflow/DFlowAlg1.cxx:38
AthViews::DFlowAlg1::m_r_int
SG::ReadHandleKey< int > m_r_int
Definition
AthViews/src_dflow/DFlowAlg1.h:37
AthViews::DFlowAlg1::m_w_int
SG::WriteHandleKey< int > m_w_int
Definition
AthViews/src_dflow/DFlowAlg1.h:38
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::VarHandleBase::store
std::string store() const
Return the name of the store holding the object we are proxying.
Definition
StoreGate/src/VarHandleBase.cxx:382
SG::VarHandleBase::clid
CLID clid() const
Return the class ID for the referenced object.
SG::VarHandleBase::name
const std::string & name() const
Return the StoreGate ID for the referenced object.
Definition
AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:75
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::cptr
const_pointer_type cptr() const
Dereference the pointer.
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::WriteHandle::recordNonConst
StatusCode recordNonConst(std::unique_ptr< T > data)
Record a non-const object to the store.
SG::WriteHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
AthViews
Definition
ViewDataVerifier.cxx:18
Generated on
for ATLAS Offline Software by
1.17.0