| The Gaudi Framework v30r0 (c919700c)

- 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 {
5 namespace Hive
6 {
7 class FetchDataFromFile final : public GaudiAlgorithm
8 {
9 public:
10 using GaudiAlgorithm::GaudiAlgorithm;
11 StatusCode initialize() override
12 {
13 StatusCode sc = GaudiAlgorithm::initialize();
14 if ( sc ) {
15 // this is a hack to reuse the automatic dependencies declaration
16 for ( auto k : m_dataKeys ) {
17 addDependency( k, Gaudi::DataHandle::Writer );
18 }
19 }
20 return sc;
21 }
22 StatusCode start() override
23 {
24 StatusCode sc = GaudiAlgorithm::start();
25 if ( sc ) {
26 for ( const auto& k : outputDataObjs() ) {
27 if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) debug() << "adding data key " << k << endmsg;
28 evtSvc()->addPreLoadItem( k.key() );
29 }
30 }
31 return sc;
32 }
33 StatusCode execute() override { return evtSvc()->preLoad(); }
34
35 private:
36 Gaudi::Property<std::vector<std::string>> m_dataKeys{
37 this, "DataKeys", {}, "list of objects to be read from file"};
38 };
39 }
40 }
41 using Gaudi::Hive::FetchDataFromFile;
42 DECLARE_COMPONENT( FetchDataFromFile )
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:128
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:319
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:43
DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > > >::outputDataObjs
const DataObjIDColl & outputDataObjs() const override
Definition: DataHandleHolderBase.h:62
GaudiAlgorithm.h
Header file for class GaudiAlgorithm.
MSG::DEBUG
Definition: IMessageSvc.h:16
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:36
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:33
Gaudi::Hive::FetchDataFromFile
Definition: FetchDataFromFile.cpp:7
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:11
DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > > >::addDependency
void addDependency(const DataObjID &id, const Gaudi::DataHandle::Mode &mode) override
Definition: DataHandleHolderBase.h:64
Algorithm::evtSvc
SmartIF< IDataProviderSvc > & evtSvc() const
shortcut for method eventSvc
Definition: Algorithm.h:282
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:115
Hive
Definition: HiveEventRegistryEntry.h:24
Algorithm::start
StatusCode start() override
the default (empty) implementation of IStateful::start() method
Definition: Algorithm.h:183
Gaudi::DataHandle::Writer
Definition: DataHandle.h:31
CommonMessagingBase::msgLevel
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
Definition: CommonMessaging.h:124
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:209
Gaudi::Hive::FetchDataFromFile::start
StatusCode start() override
Definition: FetchDataFromFile.cpp:22
Gaudi::Hive::FetchDataFromFile::execute
StatusCode execute() override
Definition: FetchDataFromFile.cpp:33