The Gaudi Framework  v30r5 (c7afbd0d)
FetchDataFromFile.cpp
Go to the documentation of this file.
2 
3 namespace Gaudi
4 {
5  namespace Hive
6  {
7  class FetchDataFromFile final : public Algorithm
8  {
9  public:
10  FetchDataFromFile( const std::string& name, ISvcLocator* pSvcLocator ) : Algorithm( name, pSvcLocator )
11  {
12  // make sure this algorithm is seen as reentrant by Gaudi
13  this->setProperty( "Cardinality", 0 );
14  }
16  {
18  if ( sc ) {
19  // this is a hack to reuse the automatic dependencies declaration
20  for ( auto k : m_dataKeys ) {
22  }
23  }
24  return sc;
25  }
26  StatusCode start() override
27  {
29  if ( sc ) {
30  for ( const auto& k : outputDataObjs() ) {
31  if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) debug() << "adding data key " << k << endmsg;
32  evtSvc()->addPreLoadItem( k.key() );
33  }
34  }
35  return sc;
36  }
37  StatusCode execute() override { return evtSvc()->preLoad(); }
38 
39  private:
41  this, "DataKeys", {}, "list of objects to be read from file"};
42  };
43  }
44 }
#define UNLIKELY(x)
Definition: Kernel.h:89
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:759
Implementation of property with value of concrete type.
Definition: Property.h:383
StatusCode setProperty(const Gaudi::Details::PropertyBase &p) override
set the property form another property
virtual StatusCode addPreLoadItem(const DataStoreItem &item)=0
Add an item to the preload list.
Header file for class GaudiAlgorithm.
virtual StatusCode preLoad()=0
Load all preload items of the list.
Gaudi::Property< std::vector< std::string > > m_dataKeys
STL class.
#define DECLARE_COMPONENT(type)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
FetchDataFromFile(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize() override
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
SmartIF< IDataProviderSvc > & evtSvc() const
shortcut for method eventSvc
Definition: Algorithm.h:281
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition: Algorithm.h:180
StatusCode start() override
the default (empty) implementation of IStateful::start() method
Definition: Algorithm.h:182
Helper functions to set/get the application return code.
Definition: __init__.py:1
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)