| The Gaudi Framework v27r1

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Member Functions | Private Attributes | List of all members
DataSvcFileEntriesTool Class Reference

Tool to scan a transient store branch that collects all the objects that belong to the same source (file). More...

Inheritance diagram for DataSvcFileEntriesTool:
[legend]
Collaboration diagram for DataSvcFileEntriesTool:
[legend]

## Public Member Functions
| DataSvcFileEntriesTool (const std::string &type, const std::string &name, const IInterface *parent)
| Standard constructor. More...
| ~DataSvcFileEntriesTool () override=default
| Destructor. More...
StatusCode | initialize () override
| Initialize the tool. More...
StatusCode | finalize () override
| Finalize the tool. More...
const LeavesList & | leaves () const override
| Return the list of collected objects. More...
void | handle (const Incident &incident) override
| Call-back function for the BeginEvent incident. More...
Public Member Functions inherited from extends< AlgTool, IDataStoreLeaves, IIncidentListener >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| ~extends () override=default
| Virtual destructor. More...
Public Member Functions inherited from AlgTool
StatusCode | queryInterface (const InterfaceID &riid, void **ppvUnknown) override
| Query for a given interface. More...
const std::string & | name () const override
| Retrieve full identifying name of the concrete tool object. More...
const std::string & | type () const override
| Retrieve type (concrete class) of the sub-algtool. More...
const IInterface * | parent () const override
| Retrieve parent of the sub-algtool. More...
StatusCode | configure () override
StatusCode | initialize () override
StatusCode | start () override
StatusCode | stop () override
StatusCode | finalize () override
StatusCode | terminate () override
StatusCode | reinitialize () override
StatusCode | restart () override
Gaudi::StateMachine::State | FSMState () const override
Gaudi::StateMachine::State | targetFSMState () const override
StatusCode | sysInitialize () override
| Initialize AlgTool. More...
StatusCode | sysStart () override
| Start AlgTool. More...
StatusCode | sysStop () override
| Stop AlgTool. More...
StatusCode | sysFinalize () override
| Finalize AlgTool. More...
StatusCode | sysReinitialize () override
| Initialize AlgTool. More...
StatusCode | sysRestart () override
| Start AlgTool. More...
StatusCode | setProperty (const Property &p) override
| Default implementations for IProperty interface. More...
StatusCode | setProperty (const std::string &s) override
StatusCode | setProperty (const std::string &n, const std::string &v) override
StatusCode | getProperty (Property *p) const override
const Property & | getProperty (const std::string &name) const override
StatusCode | getProperty (const std::string &n, std::string &v) const override
const std::vector< Property * > & | getProperties () const override
bool | hasProperty (const std::string &name) const override
PropertyMgr * | getPropertyMgr () const
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
| AlgTool (const std::string &type, const std::string &name, const IInterface *parent)
| Standard Constructor. More...
SmartIF< ISvcLocator > & | serviceLocator () const override
| Retrieve pointer to service locator. More...
ISvcLocator * | svcLoc () const
| shortcut for the method service locator More...
IDataProviderSvc * | evtSvc () const
| accessor to event service service More...
IToolSvc * | toolSvc () const
| The standard ToolSvc service, Return a pointer to the service if present. More...
StatusCode | setProperties ()
| Method for setting declared properties to the values specified in the jobOptions via the job option service. More...
template<class T >
StatusCode | service (const std::string &name, T *&svc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist. More...
template<class T >
StatusCode | service (const std::string &type, const std::string &name, T *&svc) const
| Access a service by name, type creating it if it doesn't already exist. More...
SmartIF< IService > | service (const std::string &name, const bool createIf=true, const bool quiet=false) const
| Return a pointer to the service identified by name (or "type/name") More...
template<typename T >
SmartIF< T > | service (const std::string &name, const bool createIf=true, const bool quiet=false) const
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property. More...
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties. More...
template<class T >
Property * | declareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none") const
template<class T >
StatusCode | declareTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
template<class T >
Property * | declareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none") const
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override
virtual const DataObjIDColl & | extraInputDeps () const override
virtual const DataObjIDColl & | extraOutputDeps () const override
virtual void | acceptDHVisitor (IDataHandleVisitor *) const override
DataObjIDColl | inputDataObjs () const
DataObjIDColl | outputDataObjs () const
void | commitHandles () override
void | registerTool (IAlgTool *tool) const
void | deregisterTool (IAlgTool *tool) const
template<class T >
StatusCode | declarePublicTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used public tool. More...
template<class T >
StatusCode | declarePrivateTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used private tool. More...
const std::vector< IAlgTool * > & | tools () const
IAuditorSvc * | auditorSvc () const
| Access the auditor service. More...
IMonitorSvc * | monitorSvc () const
| Access the monitor service. More...
template<class T >
void | declareInfo (const std::string &name, const T &var, const std::string &desc) const
| Declare monitoring information. More...
void | declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const
| Declare monitoring information (special case) More...
| ~AlgTool () override
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
Public Member Functions inherited from extend_interfaces< Interfaces...>
| ~extend_interfaces () override=default
| Virtual destructor. More...

## Private Member Functions
void | i_collectLeaves ()
| Scan the data service starting from the node specified as Root. More...
void | i_collectLeaves (IRegistry *reg)
| Scan the data service starting from the specified node. More...
IRegistry * | i_getRootNode ()
| Return the pointer to the IRegistry object associated to the node specified as Root. More...

## Private Attributes
std::string | m_dataSvcName
| Variable for the property DataService. More...
std::string | m_rootNode
| Variable for the property Root. More...
bool | m_scanOnBeginEvent
| Variable for the property ScanOnBeginEvent. More...
SmartIF< IIncidentSvc > | m_incidentSvc
| Pointer to the incident service. More...
SmartIF< IDataManagerSvc > | m_dataMgrSvc
| Pointer to the IDataManagerSvc interface of the data service. More...
SmartIF< IDataProviderSvc > | m_dataSvc
| Pointer to the IDataProviderSvc interface of the data service. More...
LeavesList | m_leaves
| Internal cache for the list of objects found during the scan. More...
std::string | m_initialBase
| File ID of the Root node. More...
bool | m_ignoreOriginChange
| Variable for the property ScanOnBeginEvent. More...

## Additional Inherited Members
Public Types inherited from extends< AlgTool, IDataStoreLeaves, IIncidentListener >
using | base_class = extends
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces...>
| Typedef to the base of this class. More...
Public Types inherited from AlgTool
typedef Gaudi::PluginService::Factory< IAlgTool *, const std::string &, const std::string &, const IInterface * > | Factory
Public Types inherited from CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > >
using | base_class = CommonMessaging
Public Types inherited from extend_interfaces< Interfaces...>
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
| take union of the ext_iids of all Interfaces... More...
Protected Member Functions inherited from AlgTool
template<typename I >
void | declareInterface (I *i)
virtual void | declareInput (Gaudi::DataHandle *im) override
virtual void | declareOutput (Gaudi::DataHandle *im) override
std::vector< IAlgTool * > & | tools ()
Protected Member Functions inherited from CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > >
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...
Protected Attributes inherited from AlgTool
std::unique_ptr< IDataHandleVisitor > | m_updateDataHandles
| Hook for for derived classes to provide a custom visitor for data handles. More...
SmartIF< PropertyMgr > | m_propertyMgr
| Property Manager. More...

## Detailed Description

Tool to scan a transient store branch that collects all the objects that belong to the same source (file).

By default, the list of entries is cached and the cache is cleared at every BeginEvent incident.

Properties:

  DataService (string): Name of the data service to use [EventDataSvc]

  Root (string): Path to the element from which to start the scan [root of the data service]

  ScanOnBeginEvent (bool): If the scan has to be started during the BeginEvent incident (true) or on demand (false, default)

Definition at line 26 of file DataSvcFileEntriesTool.cpp.

## Constructor & Destructor Documentation

DataSvcFileEntriesTool::DataSvcFileEntriesTool | ( | const std::string & | type,
|  | const std::string & | name,
|  | const IInterface * | parent
| ) |  |

Standard constructor.

Definition at line 104 of file DataSvcFileEntriesTool.cpp.

106 :
107 base_class(type, name, parent) {
108
109 declareProperty("DataService", m_dataSvcName = "EventDataSvc",
110 "Name of the data service to use");
111
112 declareProperty("Root", m_rootNode,
113 "Path to the element from which to start the scan");
114
115 declareProperty("ScanOnBeginEvent", m_scanOnBeginEvent = false,
116 "If the scan has to be started during the BeginEvent incident (true) or on demand (false, default)");
117
118 declareProperty("IgnoreOriginChange", m_ignoreOriginChange = false,
119 "Disable the detection of the change in the origin of object between the BeginEvent and the scan");
120 }
DataSvcFileEntriesTool::m_ignoreOriginChange
bool m_ignoreOriginChange
Variable for the property ScanOnBeginEvent.
Definition: DataSvcFileEntriesTool.cpp:90
DataSvcFileEntriesTool::m_scanOnBeginEvent
bool m_scanOnBeginEvent
Variable for the property ScanOnBeginEvent.
Definition: DataSvcFileEntriesTool.cpp:62
extends< AlgTool, IDataStoreLeaves, IIncidentListener >::base_class
extends base_class
Typedef to this class.
Definition: extends.h:14
AlgTool::declareProperty
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: AlgTool.h:249
DataSvcFileEntriesTool::m_dataSvcName
std::string m_dataSvcName
Variable for the property DataService.
Definition: DataSvcFileEntriesTool.cpp:58
DataSvcFileEntriesTool::m_rootNode
std::string m_rootNode
Variable for the property Root.
Definition: DataSvcFileEntriesTool.cpp:60

DataSvcFileEntriesTool::~DataSvcFileEntriesTool | ( |  | ) |
| override default

Destructor.

## Member Function Documentation

StatusCode DataSvcFileEntriesTool::finalize | ( |  | ) |
| override

Finalize the tool.

Definition at line 153 of file DataSvcFileEntriesTool.cpp.

153 {
154 // unregister from the incident service
155 if (m_incidentSvc) {
156 m_incidentSvc->removeListener(this, IncidentType::BeginEvent);
157 }
158 // Release the services
159 m_incidentSvc.reset();
160 m_dataMgrSvc.reset();
161 m_dataSvc.reset();
162
163 return AlgTool::finalize();
164 }
DataSvcFileEntriesTool::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to the incident service.
Definition: DataSvcFileEntriesTool.cpp:65
DataSvcFileEntriesTool::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to the IDataProviderSvc interface of the data service.
Definition: DataSvcFileEntriesTool.cpp:69
DataSvcFileEntriesTool::m_dataMgrSvc
SmartIF< IDataManagerSvc > m_dataMgrSvc
Pointer to the IDataManagerSvc interface of the data service.
Definition: DataSvcFileEntriesTool.cpp:67
AlgTool::finalize
StatusCode finalize() override
Definition: AlgTool.cpp:360
SmartIF::reset
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:88
IIncidentSvc::removeListener
virtual void removeListener(IIncidentListener *lis, const std::string &type="")=0
Remove listener.

void DataSvcFileEntriesTool::handle | ( | const Incident & | incident | ) |
| override

Call-back function for the BeginEvent incident.

Clears the internal cache, cache the file ID of the Root node and, if the property ScanOnBeginEvent is set to true, scans the data service.

Definition at line 166 of file DataSvcFileEntriesTool.cpp.

166 {
167 // Get the file id of the root node at every event
168 IOpaqueAddress *addr = i_getRootNode()->address();
169 if (addr)
170 m_initialBase = addr->par()[0];
171 else
172 m_initialBase.clear(); // use empty file id if there is no address
173
174 m_leaves.clear();
175 if (m_scanOnBeginEvent) {
176 verbose() << "::handle scanning on " << incident.type() << endmsg;
177 i_collectLeaves();
178 }
179 }
IOpaqueAddress::par
virtual const std::string * par() const =0
Retrieve String parameters.
Incident::type
const std::string & type() const
Access to the incident type.
Definition: Incident.h:41
CommonMessagingBase::verbose
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
Definition: CommonMessaging.h:130
DataSvcFileEntriesTool::m_scanOnBeginEvent
bool m_scanOnBeginEvent
Variable for the property ScanOnBeginEvent.
Definition: DataSvcFileEntriesTool.cpp:62
DataSvcFileEntriesTool::m_initialBase
std::string m_initialBase
File ID of the Root node.
Definition: DataSvcFileEntriesTool.cpp:87
DataSvcFileEntriesTool::i_collectLeaves
void i_collectLeaves()
Scan the data service starting from the node specified as Root.
Definition: DataSvcFileEntriesTool.cpp:198
std::string::clear
T clear(T...args)
IRegistry::address
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
DataSvcFileEntriesTool::m_leaves
LeavesList m_leaves
Internal cache for the list of objects found during the scan.
Definition: DataSvcFileEntriesTool.cpp:72
DataSvcFileEntriesTool::i_getRootNode
IRegistry * i_getRootNode()
Return the pointer to the IRegistry object associated to the node specified as Root.
Definition: DataSvcFileEntriesTool.cpp:188
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

void DataSvcFileEntriesTool::i_collectLeaves | ( |  | ) |
| private

Scan the data service starting from the node specified as Root.

Definition at line 198 of file DataSvcFileEntriesTool.cpp.

198 {
199 i_collectLeaves(i_getRootNode());
200 }
DataSvcFileEntriesTool::i_collectLeaves
void i_collectLeaves()
Scan the data service starting from the node specified as Root.
Definition: DataSvcFileEntriesTool.cpp:198
DataSvcFileEntriesTool::i_getRootNode
IRegistry * i_getRootNode()
Return the pointer to the IRegistry object associated to the node specified as Root.
Definition: DataSvcFileEntriesTool.cpp:188

void DataSvcFileEntriesTool::i_collectLeaves | ( | IRegistry * | reg | ) |
| private

Scan the data service starting from the specified node.

todo: implement the scanning as an IDataStoreAgent

Definition at line 203 of file DataSvcFileEntriesTool.cpp.

203 {
204 // I do not put sanity checks on the pointers because I know how I'm calling the function
205 IOpaqueAddress *addr = reg->address();
206 if (addr) { // we consider only objects that are in a file
207 if (msgLevel(MSG::VERBOSE))
208 verbose() << "::i_collectLeaves added " << reg->identifier() << endmsg;
209 m_leaves.push_back(reg->object()); // add this object
210 // Origin of the current object
211 const std::string& base = addr->par()[0];
212 // Compare with the origin seen during BeginEvent
213 if ( !m_ignoreOriginChange && (m_initialBase != base) )
214 throw GaudiException("Origin of data has changed ('"
215 + m_initialBase + "' != '" + base
216 + "'), probably OutputStream was called before "
217 "InputCopyStream: check options",
218 name(), StatusCode::FAILURE);
219
220 std::vector<IRegistry*> lfs; // leaves of the current object
221 StatusCode sc = m_dataMgrSvc->objectLeaves(reg, lfs);
222 if (sc.isSuccess()) {
223 for(const auto& i : lfs) {
224 // Continue if the leaf has the same database as the parent
225 if ( i->address() && i->address()->par()[0] == base ) {
226 DataObject* obj = nullptr;
227 sc = m_dataSvc->retrieveObject(reg, i->name(), obj);
228 if (sc.isSuccess()) {
229 i_collectLeaves(i);
230 } else {
231 throw GaudiException("Cannot get " + i->identifier() + " from " + m_dataSvcName, name(), StatusCode::FAILURE);
232 }
233 }
234 }
235 }
236 }
237 }
IOpaqueAddress::par
virtual const std::string * par() const =0
Retrieve String parameters.
DataSvcFileEntriesTool::m_ignoreOriginChange
bool m_ignoreOriginChange
Variable for the property ScanOnBeginEvent.
Definition: DataSvcFileEntriesTool.cpp:90
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
CommonMessagingBase::verbose
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
Definition: CommonMessaging.h:130
MSG::VERBOSE
Definition: IMessageSvc.h:17
merge_files.sc
int sc
Definition: merge_files.py:167
DataSvcFileEntriesTool::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to the IDataProviderSvc interface of the data service.
Definition: DataSvcFileEntriesTool.cpp:69
DataSvcFileEntriesTool::m_initialBase
std::string m_initialBase
File ID of the Root node.
Definition: DataSvcFileEntriesTool.cpp:87
DataSvcFileEntriesTool::m_dataMgrSvc
SmartIF< IDataManagerSvc > m_dataMgrSvc
Pointer to the IDataManagerSvc interface of the data service.
Definition: DataSvcFileEntriesTool.cpp:67
std::string
STL class.
DataSvcFileEntriesTool::i_collectLeaves
void i_collectLeaves()
Scan the data service starting from the node specified as Root.
Definition: DataSvcFileEntriesTool.cpp:198
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IRegistry::address
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
IRegistry::object
virtual DataObject * object() const =0
Retrieve object behind the link.
IDataManagerSvc::objectLeaves
virtual StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves)=0
Explore the object store: retrieve all leaves attached to the object The object is identified by its ...
DataSvcFileEntriesTool::m_dataSvcName
std::string m_dataSvcName
Variable for the property DataService.
Definition: DataSvcFileEntriesTool.cpp:58
std::vector< IRegistry * >
IRegistry::identifier
virtual const id_type & identifier() const =0
Full identifier (or key)
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
DataSvcFileEntriesTool::m_leaves
LeavesList m_leaves
Internal cache for the list of objects found during the scan.
Definition: DataSvcFileEntriesTool.cpp:72
CommonMessagingBase::msgLevel
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
Definition: CommonMessaging.h:136
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
ana.i
list i
Definition: ana.py:128
AlgTool::name
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:65
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
IDataProviderSvc::retrieveObject
virtual StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.

IRegistry * DataSvcFileEntriesTool::i_getRootNode | ( |  | ) |
| private

Return the pointer to the IRegistry object associated to the node specified as Root.

Definition at line 188 of file DataSvcFileEntriesTool.cpp.

188 {
189 DataObject * obj = nullptr;
190 StatusCode sc = m_dataSvc->retrieveObject(m_rootNode, obj);
191 if (sc.isFailure()) {
192 throw GaudiException("Cannot get " + m_rootNode + " from " + m_dataSvcName, name(), StatusCode::FAILURE);
193 }
194 return obj->registry();
195 }
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
merge_files.sc
int sc
Definition: merge_files.py:167
DataSvcFileEntriesTool::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to the IDataProviderSvc interface of the data service.
Definition: DataSvcFileEntriesTool.cpp:69
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
DataObject::registry
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
DataSvcFileEntriesTool::m_dataSvcName
std::string m_dataSvcName
Variable for the property DataService.
Definition: DataSvcFileEntriesTool.cpp:58
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
DataSvcFileEntriesTool::m_rootNode
std::string m_rootNode
Variable for the property Root.
Definition: DataSvcFileEntriesTool.cpp:60
AlgTool::name
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:65
IDataProviderSvc::retrieveObject
virtual StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.

StatusCode DataSvcFileEntriesTool::initialize | ( |  | ) |
| override

Initialize the tool.

Definition at line 122 of file DataSvcFileEntriesTool.cpp.

122 {
123 StatusCode sc = AlgTool::initialize();
124 if (sc.isFailure()) return sc;
125
126 // Retrieve the pointer to the needed services.
127
128 m_incidentSvc = serviceLocator()->service("IncidentSvc");
129 if ( ! m_incidentSvc ) {
130 error() << "Cannot get IncidentSvc" << endmsg;
131 return StatusCode::FAILURE;
132 }
133
134 m_dataMgrSvc = m_dataSvc = serviceLocator()->service(m_dataSvcName);
135 if ( ! m_dataSvc || ! m_dataMgrSvc ) {
136 error() << "Cannot get IDataProviderSvc+IDataManagerSvc " << m_dataSvcName << endmsg;
137 return StatusCode::FAILURE;
138 }
139
140 // Register ourself to the incident service as listener for BeginEvent
141 m_incidentSvc->addListener(this, IncidentType::BeginEvent);
142
143 // If the Root node is not specified, take the name from the data service itself.
144 if (m_rootNode.empty()) {
145 m_rootNode = m_dataMgrSvc->rootName();
146 }
147
148 // Clear the cache (in case the instance is re-initilized).
149 m_leaves.clear();
150 return StatusCode::SUCCESS;
151 }
std::string::empty
T empty(T...args)
AlgTool::initialize
StatusCode initialize() override
Definition: AlgTool.cpp:290
DataSvcFileEntriesTool::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to the incident service.
Definition: DataSvcFileEntriesTool.cpp:65
merge_files.sc
int sc
Definition: merge_files.py:167
DataSvcFileEntriesTool::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to the IDataProviderSvc interface of the data service.
Definition: DataSvcFileEntriesTool.cpp:69
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
DataSvcFileEntriesTool::m_dataMgrSvc
SmartIF< IDataManagerSvc > m_dataMgrSvc
Pointer to the IDataManagerSvc interface of the data service.
Definition: DataSvcFileEntriesTool.cpp:67
AlgTool::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: AlgTool.cpp:86
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IDataManagerSvc::rootName
virtual const std::string & rootName() const =0
Get Name of root Event.
DataSvcFileEntriesTool::m_dataSvcName
std::string m_dataSvcName
Variable for the property DataService.
Definition: DataSvcFileEntriesTool.cpp:58
IIncidentSvc::addListener
virtual void addListener(IIncidentListener *lis, const std::string &type="", long priority=0, bool rethrow=false, bool singleShot=false)=0
Add listener.
DataSvcFileEntriesTool::m_leaves
LeavesList m_leaves
Internal cache for the list of objects found during the scan.
Definition: DataSvcFileEntriesTool.cpp:72
DataSvcFileEntriesTool::m_rootNode
std::string m_rootNode
Variable for the property Root.
Definition: DataSvcFileEntriesTool.cpp:60
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

const IDataStoreLeaves::LeavesList & DataSvcFileEntriesTool::leaves | ( |  | ) | const
| override

Return the list of collected objects.

If the scan was not yet done since the last BeginEvent incident, it is done when calling this function. The result of the scan is cached.

Definition at line 181 of file DataSvcFileEntriesTool.cpp.

181 {
182 if (m_leaves.empty()) {
183 const_cast<DataSvcFileEntriesTool*>(this)->i_collectLeaves();
184 }
185 return m_leaves;
186 }
DataSvcFileEntriesTool
Tool to scan a transient store branch that collects all the objects that belong to the same source (f...
Definition: DataSvcFileEntriesTool.cpp:26
DataSvcFileEntriesTool::i_collectLeaves
void i_collectLeaves()
Scan the data service starting from the node specified as Root.
Definition: DataSvcFileEntriesTool.cpp:198
DataSvcFileEntriesTool::m_leaves
LeavesList m_leaves
Internal cache for the list of objects found during the scan.
Definition: DataSvcFileEntriesTool.cpp:72

## Member Data Documentation

SmartIF<IDataManagerSvc> DataSvcFileEntriesTool::m_dataMgrSvc
| private

Pointer to the IDataManagerSvc interface of the data service.

Definition at line 67 of file DataSvcFileEntriesTool.cpp.

SmartIF<IDataProviderSvc> DataSvcFileEntriesTool::m_dataSvc
| private

Pointer to the IDataProviderSvc interface of the data service.

Definition at line 69 of file DataSvcFileEntriesTool.cpp.

std::string DataSvcFileEntriesTool::m_dataSvcName
| private

Variable for the property DataService.

Definition at line 58 of file DataSvcFileEntriesTool.cpp.

bool DataSvcFileEntriesTool::m_ignoreOriginChange
| private

Variable for the property ScanOnBeginEvent.

Definition at line 90 of file DataSvcFileEntriesTool.cpp.

SmartIF<IIncidentSvc> DataSvcFileEntriesTool::m_incidentSvc
| private

Pointer to the incident service.

Definition at line 65 of file DataSvcFileEntriesTool.cpp.

std::string DataSvcFileEntriesTool::m_initialBase
| private

File ID of the Root node.

It is cached every BeginEvent to be compared with the one seen during the collection of the leaves, to avoid that the collection is altered by previous calls to an OutputStream.

Definition at line 87 of file DataSvcFileEntriesTool.cpp.

LeavesList DataSvcFileEntriesTool::m_leaves
| private

Internal cache for the list of objects found during the scan.

Definition at line 72 of file DataSvcFileEntriesTool.cpp.

std::string DataSvcFileEntriesTool::m_rootNode
| private

Variable for the property Root.

Definition at line 60 of file DataSvcFileEntriesTool.cpp.

bool DataSvcFileEntriesTool::m_scanOnBeginEvent
| private

Variable for the property ScanOnBeginEvent.

Definition at line 62 of file DataSvcFileEntriesTool.cpp.

The documentation for this class was generated from the following file:

- GaudiCommonSvc/src/PersistencySvc/DataSvcFileEntriesTool.cpp