Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
FetchDataFromFile.cpp
Go to the documentation of this file.
2 
3 namespace Gaudi {
4  namespace Hive {
5  class FetchDataFromFile final : public ::Algorithm {
6  public:
7  FetchDataFromFile( const std::string& name, ISvcLocator* pSvcLocator ) : Algorithm( name, pSvcLocator ) {
8  // make sure this algorithm is seen as reentrant by Gaudi
9  this->setProperty( "Cardinality", 0 );
10  }
11  StatusCode initialize() override {
13  if ( sc ) {
14  // this is a hack to reuse the automatic dependencies declaration
15  for ( auto k : m_dataKeys ) { addDependency( k, Gaudi::DataHandle::Writer ); }
16  }
17  return sc;
18  }
19  StatusCode start() override {
21  if ( sc ) {
22  for ( const auto& k : outputDataObjs() ) {
23  if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) debug() << "adding data key " << k << endmsg;
24  evtSvc()->addPreLoadItem( k.key() );
25  }
26  }
27  return sc;
28  }
29  StatusCode execute() override { return evtSvc()->preLoad(); }
30 
31  private:
33  this, "DataKeys", {}, "list of objects to be read from file"};
34  };
35  } // namespace Hive
36 } // namespace Gaudi
#define UNLIKELY(x)
Definition: Kernel.h:89
SmartIF< IDataProviderSvc > & evtSvc() const
shortcut for method eventSvc
Definition: Algorithm.h:265
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
Implementation of property with value of concrete type.
Definition: Property.h:352
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.
StatusCode start() override
the default (empty) implementation of IStateful::start() method
Definition: Algorithm.h:182
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:635
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)
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition: Algorithm.h:180
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
FetchDataFromFile(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize() override
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
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:192
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)