The Gaudi Framework  master (37c0b60a)
RecordOutputStream.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #include "RecordOutputStream.h"
12 #include <GaudiKernel/DataObject.h>
13 
14 // ----------------------------------------------------------------------------
15 // Implementation file for class: RecordOutputStream
16 //
17 // 30/08/2013: Marco Clemencic
18 // ----------------------------------------------------------------------------
20 
21 // ============================================================================
22 // Initialization
23 // ============================================================================
25  StatusCode sc = Algorithm::initialize(); // must be executed first
26  if ( sc.isFailure() ) return sc; // error printed already by Algorithm
27 
28  if ( msgLevel( MSG::DEBUG ) ) debug() << "==> Initialize" << endmsg;
29 
30  if ( m_streamName.empty() ) {
31  m_streamName = "Deferred:" + name();
32  debug() << "Using default OutputStreamName: '" << m_streamName << "'" << endmsg;
33  }
34 
35  m_flagLocation = locationRoot() + "/" + m_streamName;
36  return StatusCode::SUCCESS;
37 }
38 
39 // ============================================================================
40 // Main execution
41 // ============================================================================
43  if ( msgLevel( MSG::DEBUG ) ) debug() << "==> Execute" << endmsg;
44 
45  DataObject* tmp = nullptr;
46  if ( !eventSvc()->retrieveObject( m_flagLocation, tmp ) ) {
47  tmp = new DataObject();
48  return eventSvc()->registerObject( m_flagLocation, tmp );
49  }
50  return StatusCode::SUCCESS;
51 }
MSG::DEBUG
@ DEBUG
Definition: IMessageSvc.h:25
GaudiPython.Bindings.DataObject
DataObject
Definition: Bindings.py:82
RecordOutputStream::m_flagLocation
std::string m_flagLocation
location of the DataObject flag used to record that this algorithm was called
Definition: RecordOutputStream.h:45
Gaudi::Algorithm::eventSvc
SmartIF< IDataProviderSvc > & eventSvc() const
The standard event data service.
Definition: Algorithm.cpp:559
Gaudi::Algorithm::initialize
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition: Algorithm.h:178
RecordOutputStream::execute
StatusCode execute() override
Algorithm execution.
Definition: RecordOutputStream.cpp:42
CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > >::msgLevel
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
Definition: CommonMessaging.h:148
StatusCode
Definition: StatusCode.h:65
RecordOutputStream
Definition: RecordOutputStream.h:28
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:129
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
DataObject.h
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
DataObject
Definition: DataObject.h:36
RecordOutputStream.h