| The Gaudi Framework v30r0 (c919700c)

- 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
46 private:
47 ReplayOutputStream* m_ptr;
48 };
49
51 class OutStreamTrigger
52 {
53 public:
54 OutStreamTrigger( ReplayOutputStream* ptr ) : m_ptr( ptr ) {}
55 inline void operator()( const std::string& name ) const
56 {
57 SmartIF<IAlgorithm>& alg = m_ptr->m_outputStreams[name];
58 if ( alg ) {
59 if ( !alg->isExecuted() ) {
60 alg->sysExecute( Gaudi::Hive::currentContext() );
61 } else {
62 m_ptr->warning() << name << " already executed for the current event" << endmsg;
63 }
64 } else {
65 m_ptr->warning() << "invalid OuputStream " << name << endmsg;
66 }
67 }
68
69 private:
70 ReplayOutputStream* m_ptr;
71 };
72
75 template <Gaudi::StateMachine::Transition TR>
76 StatusCode i_outStreamTransition();
77
78 Gaudi::Property<std::vector<std::string>> m_outputStreamNames{
79 this, "OutputStreams", {}, "OutputStream instances that can be called."};
80
82 OutStreamsMapType m_outputStreams;
83
84 SmartIF<IAlgManager> m_algMgr;
85 SmartIF<IDataManagerSvc> m_evtMgr;
86 };
87
88 #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:737
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:319
ReplayOutputStream::m_outputStreams
OutStreamsMapType m_outputStreams
Internal storage for the OutputStreams to call.
Definition: ReplayOutputStream.h:82
IDataManagerSvc
Definition: IDataManagerSvc.h:46
ReplayOutputStream::OutStreamTrigger
Helper class to call the required OutputStream.
Definition: ReplayOutputStream.h:51
ReplayOutputStream::finalize
StatusCode finalize() override
Algorithm finalization.
Definition: ReplayOutputStream.cpp:151
ThreadLocalContext.h
ReplayOutputStream::~ReplayOutputStream
~ReplayOutputStream() override=default
Destructor.
GaudiAlgorithm.h
Header file for class GaudiAlgorithm.
ReplayOutputStream::OutStreamTrigger::OutStreamTrigger
OutStreamTrigger(ReplayOutputStream *ptr)
Definition: ReplayOutputStream.h:54
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:47
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:81
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:109
ReplayOutputStream::stop
StatusCode stop() override
Algorithm finalization.
Definition: ReplayOutputStream.cpp:167
ReplayOutputStream::m_outputStreamNames
Gaudi::Property< std::vector< std::string > > m_outputStreamNames
Definition: ReplayOutputStream.h:78
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:70
ReplayOutputStream::i_addOutputStream
void i_addOutputStream(const Gaudi::Utils::TypeNameString &outStream)
Add a new algorithm to the list of OutputStreams.
Definition: ReplayOutputStream.cpp:178
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:136
ReplayOutputStream::start
StatusCode start() override
Algorithm initialization.
Definition: ReplayOutputStream.cpp:109
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:55
GaudiUtils::HashMap
Common class providing an architecture-independent hash map.
Definition: HashMap.h:74
ReplayOutputStream::initialize
StatusCode initialize() override
Algorithm initialization.
Definition: ReplayOutputStream.cpp:91
ReplayOutputStream::OutStreamAdder::operator()
void operator()(const Gaudi::Utils::TypeNameString &outStream)
Definition: ReplayOutputStream.h:44
ReplayOutputStream::m_evtMgr
SmartIF< IDataManagerSvc > m_evtMgr
Definition: ReplayOutputStream.h:85
ReplayOutputStream::OutStreamAdder::OutStreamAdder
OutStreamAdder(ReplayOutputStream *ptr)
Definition: ReplayOutputStream.h:43
ReplayOutputStream::m_algMgr
SmartIF< IAlgManager > m_algMgr
Definition: ReplayOutputStream.h:84
GaudiAlgorithm::GaudiAlgorithm
GaudiAlgorithm()
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209