All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RecordOutputStream.cpp
Go to the documentation of this file.
1 // Include files
2 
3 // From Gaudi
5 // local
6 #include "RecordOutputStream.h"
7 
8 // ----------------------------------------------------------------------------
9 // Implementation file for class: RecordOutputStream
10 //
11 // 30/08/2013: Marco Clemencic
12 // ----------------------------------------------------------------------------
14 
15 // ============================================================================
16 // Standard constructor, initializes variables
17 // ============================================================================
18 RecordOutputStream::RecordOutputStream(const std::string& name, ISvcLocator* pSvcLocator)
19  : GaudiAlgorithm(name, pSvcLocator)
20 {
21  declareProperty("OutputStreamName", m_streamName,
22  "Name of the OutputStream instance should be triggered.");
23 }
24 
25 // ============================================================================
26 // Destructor
27 // ============================================================================
29 
30 // ============================================================================
31 // Initialization
32 // ============================================================================
34  StatusCode sc = GaudiAlgorithm::initialize(); // must be executed first
35  if ( sc.isFailure() ) return sc; // error printed already by GaudiAlgorithm
36 
37  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Initialize" << endmsg;
38 
39  if (m_streamName.empty()) {
40  m_streamName = "Deferred:" + name();
41  debug() << "Using default OutputStreamName: '"
42  << m_streamName << "'" << endmsg;
43  }
44 
46  return StatusCode::SUCCESS;
47 }
48 
49 // ============================================================================
50 // Main execution
51 // ============================================================================
53  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Execute" << endmsg;
54 
55  getOrCreate<DataObject, DataObject>(m_flagLocation, false);
56  /*
57  if (!exist(m_flagLocation, false)) {
58  DataObject *obj = new DataObject();
59  put(obj, m_flagLocation, false);
60  }
61  */
62  return StatusCode::SUCCESS;
63 }
64 
65 // ============================================================================
66 // Finalize
67 // ============================================================================
69  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Finalize" << endmsg;
70 
71  return GaudiAlgorithm::finalize(); // must be called after all other actions
72 }
73 
74 // ============================================================================
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:26
virtual StatusCode finalize()
Algorithm finalization.
virtual StatusCode initialize()
standard initialization method
virtual ~RecordOutputStream()
Destructor.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
virtual StatusCode initialize()
Algorithm initialization.
std::string m_flagLocation
location of the DataObject flag used to record that this algorithm was called
MSG::Level msgLevel() const
The current message service output level.
Definition: GaudiCommon.h:532
virtual StatusCode finalize()
standard finalization method
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
#define DECLARE_ALGORITHM_FACTORY(x)
Definition: Algorithm.h:605
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
The useful base class for data processing algorithms.
MsgStream & debug() const
shortcut for the method msgStream ( MSG::DEBUG )
Definition: GaudiCommon.h:499
Simple class that adds an entry to the Transient Event Store to record that the processing flow trigg...
virtual StatusCode execute()
Algorithm execution.
std::string m_streamName
Name of the OuputStream that should be called when this algorithm is triggered.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
static const std::string locationRoot()
Return the path in the Transient Store used to record the triggered instances.