| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

ReplayOutputStream.h
Go to the documentation of this file.
1 #ifndef COMPONENT_REPLAYOUTPUTSTREAM_H
2 #define COMPONENT_REPLAYOUTPUTSTREAM_H 1
3 // Include files
4 // from Gaudi
5 #include "GaudiAlg/GaudiAlgorithm.h"
6 #include "GaudiKernel/HashMap.h"
7 #include "GaudiKernel/SmartIF.h"
8 #include "GaudiKernel/ThreadLocalContext.h"
9
10 class IAlgManager;
11 class IDataManagerSvc;
12
19 class ReplayOutputStream : public GaudiAlgorithm
20 {
21 public:
23 using GaudiAlgorithm::GaudiAlgorithm;
24 ~ReplayOutputStream() override = default;
25
26 StatusCode initialize() override;
27 StatusCode start() override;
28 StatusCode execute() override;
29 StatusCode stop() override;
30 StatusCode finalize() override;
31
33 typedef GaudiUtils::HashMap<std::string, SmartIF<IAlgorithm>> OutStreamsMapType;
34
35 private:
37 void i_addOutputStream( const Gaudi::Utils::TypeNameString& outStream );
38
40 class OutStreamAdder
41 {
42 public:
43 OutStreamAdder( ReplayOutputStream* ptr ) : m_ptr( ptr ) {}
44 inline void operator()( const Gaudi::Utils::TypeNameString& outStream ) { m_ptr->i_addOutputStream( outStream ); }
45 private:
46 ReplayOutputStream* m_ptr;
47 };
48
50 class OutStreamTrigger
51 {
52 public:
53 OutStreamTrigger( ReplayOutputStream* ptr ) : m_ptr( ptr ) {}
54 inline void operator()( const std::string& name ) const
55 {
56 SmartIF<IAlgorithm>& alg = m_ptr->m_outputStreams[name];
57 if ( alg ) {
58 if ( !alg->isExecuted() ) {
59 alg->sysExecute(Gaudi::Hive::currentContext());
60 } else {
61 m_ptr->warning() << name << " already executed for the current event" << endmsg;
62 }
63 } else {
64 m_ptr->warning() << "invalid OuputStream " << name << endmsg;
65 }
66 }
67
68 private:
69 ReplayOutputStream* m_ptr;
70 };
71
74 template <Gaudi::StateMachine::Transition TR>
75 StatusCode i_outStreamTransition();
76
77 Gaudi::Property<std::vector<std::string>> m_outputStreamNames{
78 this, "OutputStreams", {}, "OutputStream instances that can be called."};
79
81 OutStreamsMapType m_outputStreams;
82
83 SmartIF<IAlgManager> m_algMgr;
84 SmartIF<IDataManagerSvc> m_evtMgr;
85 };
86
87 #endif // COMPONENT_REPLAYOUTPUTSTREAM_H
SmartIF< IAlgorithm >
ReplayOutputStream
Definition: ReplayOutputStream.h:19
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:715
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:314
ReplayOutputStream::m_outputStreams
OutStreamsMapType m_outputStreams
Internal storage for the OutputStreams to call.
Definition: ReplayOutputStream.h:81
ReplayOutputStream::OutStreamTrigger
Helper class to call the required OutputStream.
Definition: ReplayOutputStream.h:50
ReplayOutputStream::finalize
StatusCode finalize() override
Algorithm finalization.
Definition: ReplayOutputStream.cpp:146
ThreadLocalContext.h
ReplayOutputStream::~ReplayOutputStream
~ReplayOutputStream() override=default
Destructor.
GaudiAlgorithm.h
Header file for class GaudiAlgorithm.
ReplayOutputStream::OutStreamTrigger::OutStreamTrigger
OutStreamTrigger(ReplayOutputStream *ptr)
Definition: ReplayOutputStream.h:53
IAlgManager
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:27
ReplayOutputStream::OutStreamAdder::m_ptr
ReplayOutputStream * m_ptr
Definition: ReplayOutputStream.h:46
HashMap.h
std::string
STL class.
ReplayOutputStream::i_outStreamTransition
StatusCode i_outStreamTransition()
Helper function to call the transition on the contained OutputStreams.
Definition: ReplayOutputStream.cpp:78
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:12
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:120
ReplayOutputStream::stop
StatusCode stop() override
Algorithm finalization.
Definition: ReplayOutputStream.cpp:161
ReplayOutputStream::m_outputStreamNames
Gaudi::Property< std::vector< std::string > > m_outputStreamNames
Definition: ReplayOutputStream.h:77
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IAlgorithm::isExecuted
virtual bool isExecuted() const =0
check if the algorithm is already executed for the current event
SmartIF.h
GaudiAlgorithm
The useful base class for data processing algorithms.
Definition: GaudiAlgorithm.h:94
IAlgorithm::sysExecute
virtual StatusCode sysExecute(const EventContext &)=0
System execution. This method invokes the execute() method of a concrete algorithm.
Gaudi::Hive::currentContext
GAUDI_API const EventContext & currentContext()
Definition: ThreadLocalContext.cpp:24
ReplayOutputStream::OutStreamTrigger::m_ptr
ReplayOutputStream * m_ptr
Definition: ReplayOutputStream.h:69
ReplayOutputStream::i_addOutputStream
void i_addOutputStream(const Gaudi::Utils::TypeNameString &outStream)
Add a new algorithm to the list of OutputStreams.
Definition: ReplayOutputStream.cpp:171
ReplayOutputStream::OutStreamAdder
Helper class to fill the internal map of OutputStreams.
Definition: ReplayOutputStream.h:40
ReplayOutputStream::execute
StatusCode execute() override
Algorithm execution.
Definition: ReplayOutputStream.cpp:131
IDataManagerSvc
Definition: IDataManagerSvc.h:45
ReplayOutputStream::start
StatusCode start() override
Algorithm initialization.
Definition: ReplayOutputStream.cpp:105
ReplayOutputStream::OutStreamsMapType
GaudiUtils::HashMap< std::string, SmartIF< IAlgorithm > > OutStreamsMapType
Class used to hold the OutputStream instances.
Definition: ReplayOutputStream.h:33
ReplayOutputStream::OutStreamTrigger::operator()
void operator()(const std::string &name) const
Definition: ReplayOutputStream.h:54
GaudiUtils::HashMap
Common class providing an architecture-independent hash map.
Definition: HashMap.h:77
ReplayOutputStream::initialize
StatusCode initialize() override
Algorithm initialization.
Definition: ReplayOutputStream.cpp:87
ReplayOutputStream::OutStreamAdder::operator()
void operator()(const Gaudi::Utils::TypeNameString &outStream)
Definition: ReplayOutputStream.h:44
ReplayOutputStream::m_evtMgr
SmartIF< IDataManagerSvc > m_evtMgr
Definition: ReplayOutputStream.h:84
ReplayOutputStream::OutStreamAdder::OutStreamAdder
OutStreamAdder(ReplayOutputStream *ptr)
Definition: ReplayOutputStream.h:43
ReplayOutputStream::m_algMgr
SmartIF< IAlgManager > m_algMgr
Definition: ReplayOutputStream.h:83
GaudiAlgorithm::GaudiAlgorithm
GaudiAlgorithm()
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244