| The Gaudi Framework v28r2p1 (f1a77ff4)

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

- File List
- File Members

FetchDataFromFile.cpp
Go to the documentation of this file.
1 #include "GaudiAlg/GaudiAlgorithm.h"
2
3 namespace Gaudi {
4 namespace Hive {
5 class FetchDataFromFile final: public GaudiAlgorithm {
6 public:
7 using GaudiAlgorithm::GaudiAlgorithm;
8 StatusCode initialize() override {
9 StatusCode sc = GaudiAlgorithm::initialize();
10 if (sc) {
11 // this is a hack to reuse the automatic dependencies declaration
12 for (auto k: m_dataKeys) {
13 addDependency(k, Gaudi::DataHandle::Writer);
14 }
15 }
16 return sc;
17 }
18 StatusCode start() override {
19 StatusCode sc = GaudiAlgorithm::start();
20 if ( sc ) {
21 for( const auto& k: outputDataObjs() ) {
22 if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) )
23 debug() << "adding data key " << k << endmsg;
24 evtSvc()->addPreLoadItem( k.key() );
25 }
26 }
27 return sc;
28 }
29 StatusCode execute() override {
30 return evtSvc()->preLoad();
31 }
32 private:
33 Gaudi::Property<std::vector<std::string>> m_dataKeys{ this, "DataKeys", {},
34 "list of objects to be read from file" };
35 };
36 }
37 }
38 using Gaudi::Hive::FetchDataFromFile;
39 DECLARE_COMPONENT( FetchDataFromFile )
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:314
IDataProviderSvc::addPreLoadItem
virtual StatusCode addPreLoadItem(const DataStoreItem &item)=0
Add an item to the preload list.
GaudiAlgorithm::initialize
StatusCode initialize() override
standard initialization method
Definition: GaudiAlgorithm.cpp:44
DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > > >::outputDataObjs
const DataObjIDColl & outputDataObjs() const override
Definition: DataHandleHolderBase.h:63
GaudiAlgorithm.h
Header file for class GaudiAlgorithm.
MSG::DEBUG
Definition: IMessageSvc.h:18
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:126
IDataProviderSvc::preLoad
virtual StatusCode preLoad()=0
Load all preload items of the list.
Gaudi::Hive::FetchDataFromFile::m_dataKeys
Gaudi::Property< std::vector< std::string > > m_dataKeys
Definition: FetchDataFromFile.cpp:33
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
Gaudi::Hive::FetchDataFromFile
Definition: FetchDataFromFile.cpp:5
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
GaudiAlgorithm
The useful base class for data processing algorithms.
Definition: GaudiAlgorithm.h:94
Gaudi::Hive::FetchDataFromFile::initialize
StatusCode initialize() override
Definition: FetchDataFromFile.cpp:8
DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > > >::addDependency
void addDependency(const DataObjID &id, const Gaudi::DataHandle::Mode &mode) override
Definition: DataHandleHolderBase.h:65
Algorithm::evtSvc
SmartIF< IDataProviderSvc > & evtSvc() const
shortcut for method eventSvc
Definition: Algorithm.h:276
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:126
Hive
Definition: HiveEventRegistryEntry.h:24
Algorithm::start
StatusCode start() override
the default (empty) implementation of IStateful::start() method
Definition: Algorithm.h:180
Gaudi::DataHandle::Writer
Definition: DataHandle.h:32
CommonMessagingBase::msgLevel
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
Definition: CommonMessaging.h:135
GaudiAlgorithm::GaudiAlgorithm
GaudiAlgorithm()
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Gaudi::Hive::FetchDataFromFile::start
StatusCode start() override
Definition: FetchDataFromFile.cpp:18
Gaudi::Hive::FetchDataFromFile::execute
StatusCode execute() override
Definition: FetchDataFromFile.cpp:29