ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
StoreGateTests
src
SgStressConsumer.cxx
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// SgStressConsumer.cxx
8
// Implementation file for class SgStressConsumer
9
// Author: S.Binet<binet@cern.ch>
11
12
13
// STL includes
14
#include <sstream>
15
16
// FrameWork includes
17
#include "Gaudi/Property.h"
18
19
// StoreGate
20
#include "
StoreGate/StoreGateSvc.h
"
21
22
// StoreGateTests includes
23
#include "
StoreGateTests/PayLoad.h
"
24
#include "
SgStressConsumer.h
"
25
27
// Public methods:
29
30
// Constructors
32
SgStressConsumer::SgStressConsumer
(
const
std::string& name,
33
ISvcLocator* pSvcLocator ) :
34
AthAlgorithm
( name, pSvcLocator )
35
{
36
//
37
// Property declaration
38
//
39
//declareProperty( "Property", m_nProperty );
40
41
declareProperty
(
"DataName"
,
42
m_dataName
=
"MyData"
,
43
"Output location of 'Data' objects"
);
44
45
declareProperty
(
"NbrOfObjects"
,
46
m_nObjs
= 1000,
47
"Number of 'Data' objects to be stored each event"
);
48
49
}
50
51
// Destructor
53
SgStressConsumer::~SgStressConsumer
()
54
{
55
ATH_MSG_DEBUG
(
"Calling destructor"
);
56
}
57
58
// Athena Algorithm's Hooks
60
StatusCode
SgStressConsumer::initialize
()
61
{
62
// configure our MsgStream
63
msg
().setLevel( msgLevel() );
64
65
ATH_MSG_INFO
(
"Initializing "
<< name() <<
"..."
);
66
67
return
StatusCode::SUCCESS;
68
}
69
70
StatusCode
SgStressConsumer::finalize
()
71
{
72
ATH_MSG_INFO
(
"Finalizing "
<< name() <<
"..."
);
73
return
StatusCode::SUCCESS;
74
}
75
76
StatusCode
SgStressConsumer::execute
(
const
EventContext&
/*ctx*/
)
77
{
78
ATH_MSG_DEBUG
(
"Executing "
<< name() <<
"..."
);
79
return
readData
();
80
}
81
83
// Non-const methods:
85
86
StatusCode
SgStressConsumer::readData
()
87
{
88
bool
allGood =
true
;
89
for
( std::size_t iObj = 0; iObj !=
m_nObjs
; ++iObj ) {
90
std::ostringstream outName;
91
outName <<
m_dataName
<<
"_payload_"
<< iObj;
92
const
SgTests::PayLoad
* data = 0;
93
const
SgTests::PayLoadDv
* dv = 0;
94
if
( !
evtStore
()->retrieve( dv, outName.str() ).isSuccess() ) {
95
ATH_MSG_ERROR
(
"Could not retrieve payload !!"
);
96
allGood =
false
;
97
}
98
99
data = (*dv)[0];
100
if
( data->m_data.empty() ) {
101
ATH_MSG_ERROR
(
"**NOT** my data !!"
);
102
allGood =
false
;
103
}
104
}
105
106
return
allGood ? StatusCode::SUCCESS : StatusCode::FAILURE;
107
}
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
PayLoad.h
SgStressConsumer.h
StoreGateSvc.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
AthCommonAlgorithm< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition
AthCommonMsg.h:24
SgStressConsumer::readData
StatusCode readData()
Retrieve data.
Definition
SgStressConsumer.cxx:86
SgStressConsumer::m_nObjs
std::size_t m_nObjs
Number of payload objects.
Definition
SgStressConsumer.h:75
SgStressConsumer::execute
virtual StatusCode execute(const EventContext &ctx)
Execute method.
Definition
SgStressConsumer.cxx:76
SgStressConsumer::SgStressConsumer
SgStressConsumer()
Default constructor:
SgStressConsumer::m_dataName
std::string m_dataName
Name of the input data.
Definition
SgStressConsumer.h:72
SgStressConsumer::~SgStressConsumer
virtual ~SgStressConsumer()
Destructor:
Definition
SgStressConsumer.cxx:53
SgStressConsumer::initialize
virtual StatusCode initialize()
Definition
SgStressConsumer.cxx:60
SgStressConsumer::finalize
virtual StatusCode finalize()
Definition
SgStressConsumer.cxx:70
SgTests::PayLoadDv
Definition
PayLoad.h:34
SgTests::PayLoad
is a very simple class to exercize the basic features of the StoreGateSvc class: publishing and retri...
Definition
PayLoad.h:28
Generated on
for ATLAS Offline Software by
1.17.0