FetchDataFromFile.cpp
Go to the documentation of this file.
2 
3 namespace Gaudi {
4  namespace Hive {
5  class FetchDataFromFile final: public GaudiAlgorithm {
8  public:
10  GaudiAlgorithm(name, svcLoc)
11  {
12  declareProperty("DataKeys", m_dataKeys, "list of objects to be read from file");
13  }
14  StatusCode initialize() override {
16  if (sc) {
17  // this is a hack to reuse the automatic dependencies declaration
18  for (auto k: m_dataKeys.value()) {
19  debug() << "adding data key " << k << endmsg;
20  evtSvc()->addPreLoadItem(k);
21  // note: the DataObjectHandleBase constructor will 'declare' the handle
22  m_outputHandles.emplace_back( k, Gaudi::DataHandle::Writer, this );
23  }
24  }
25  return sc;
26  }
27  StatusCode execute() override {
28  return evtSvc()->preLoad();
29  }
30  };
31  }
32 }
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
SmartIF< ISvcLocator > & svcLoc() const
shortcut for method serviceLocator
Definition: Algorithm.h:323
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:727
virtual StatusCode addPreLoadItem(const DataStoreItem &item)=0
Add an item to the preload list.
StatusCode initialize() override
standard initialization method
Header file for class GaudiAlgorithm.
virtual StatusCode preLoad()=0
Load all preload items of the list.
Gaudi::Property< std::vector< std::string > > StringArrayProperty
Definition: Property.h:715
std::vector< DataObjectHandle< DataObject > > m_outputHandles
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
STL class.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
The useful base class for data processing algorithms.
StatusCode initialize() override
FetchDataFromFile(const std::string &name, ISvcLocator *svcLoc)
SmartIF< IDataProviderSvc > & evtSvc() const
shortcut for method eventSvc
Definition: Algorithm.h:276
STL class.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Gaudi::Details::PropertyBase * declareProperty(const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
Definition: Algorithm.h:366
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:244
T emplace_back(T...args)