ATLAS Offline Software
Loading...
Searching...
No Matches
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
21
22// StoreGateTests includes
24#include "SgStressConsumer.h"
25
27// Public methods:
29
30// Constructors
32SgStressConsumer::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
54{
55 ATH_MSG_DEBUG ( "Calling destructor" );
56}
57
58// Athena Algorithm's Hooks
61{
62 // configure our MsgStream
63 msg().setLevel( msgLevel() );
64
65 ATH_MSG_INFO ( "Initializing " << name() << "..." );
66
67 return StatusCode::SUCCESS;
68}
69
71{
72 ATH_MSG_INFO( "Finalizing " << name() << "..." );
73 return StatusCode::SUCCESS;
74}
75
77{
78 ATH_MSG_DEBUG ( "Executing " << name() << "..." );
79 return readData();
80}
81
83// Non-const methods:
85
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}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
MsgStream & msg() const
StatusCode readData()
Retrieve data.
std::size_t m_nObjs
Number of payload objects.
SgStressConsumer()
Default constructor:
virtual StatusCode execute()
std::string m_dataName
Name of the input data.
virtual ~SgStressConsumer()
Destructor:
virtual StatusCode initialize()
virtual StatusCode finalize()
is a very simple class to exercize the basic features of the StoreGateSvc class: publishing and retri...
Definition PayLoad.h:28