The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
NTupleSvc.cpp
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11//====================================================================
12// NTupleSvc.cpp
13//--------------------------------------------------------------------
14//
15// Package : GaudiSvc/NTupleSvc ( The LHCb Offline System)
16//
17// Description: implementation of the NTuple service
18//
19// Author : M.Frank
20// History :
21// +---------+----------------------------------------------+---------
22// | Date | Comment | Who
23// +---------+----------------------------------------------+---------
24// | 29/10/98| Initial version | MF
25// | 29/09/99| Added access to ICnvManager for missing |
26// | | converters | MF
27// | 20/09/00| Connect dynamically to conversion service |
28// | | for N-tuple persistency | MF
29// +---------+----------------------------------------------+---------
30//
31//====================================================================
32#define GAUDISVC_NTUPLESVC_CPP
33
34// Framework include files
39#include <GaudiKernel/SmartIF.h>
40
45
46#include <Gaudi/Property.h>
50#include <GaudiKernel/reverse.h>
51
52#include "NTupleSvc.h"
53
54// Instantiation of a static factory class used by clients to create
55// instances of this service
57
58// Selector factory instantiation
60
61NTupleSvc::NTupleSvc( const std::string& name, ISvcLocator* svc ) : base_class( name, svc ) {
62 m_rootName = "/NTUPLES";
63 m_rootCLID = CLID_DataObject;
64}
65
66// Initialize the service.
69 if ( status.isSuccess() ) {
71 DataObject* root = new NTuple::Directory();
72 status = setRoot( m_rootName, root );
73 for ( auto& i : m_output ) {
74 iret = connect( i );
75 if ( !iret.isSuccess() ) status = iret;
76 }
77 for ( auto& j : m_input ) {
78 iret = connect( j );
79 if ( !iret.isSuccess() ) status = iret;
80 }
81 }
82 return status;
83}
84
87
88// Check if a datasource is connected
89bool NTupleSvc::isConnected( const std::string& identifier ) const {
90 auto i = m_connections.find( identifier );
91 return i != m_connections.end();
92}
93
96 if ( !pRegistry ) return nullptr;
97 std::string full = pRegistry->identifier();
98 auto len = m_rootName.length();
99 auto idx = full.find( SEPARATOR, len + 1 );
100 std::string path = ( idx == std::string::npos ) ? full : full.substr( 0, idx );
101 auto i = m_connections.find( path );
102 return ( i != m_connections.end() ) ? i->second.service : nullptr;
103}
104
106 long need_update = 0;
107 DataObject* pO = nullptr;
108 StatusCode iret = findObject( m_rootName.value(), pO );
109 // debug() << "in finalize()" << endmsg;
110 if ( iret.isSuccess() ) {
111 std::vector<IRegistry*> leaves;
112 iret = objectLeaves( pO, leaves );
113 if ( iret.isSuccess() ) {
114 // Only traverse the tree below the files
115 for ( auto d = leaves.begin(); d != leaves.end(); d++ ) {
116 if ( !( *d )->object() ) continue;
117 IOpaqueAddress* pA = ( *d )->address();
118 if ( !pA ) continue;
119 unsigned long typ = pA->ipar()[1];
120 if ( typ != 'R' && typ != 'N' && typ != 'U' ) continue;
121 // ...starting from the file entries: first save the directories/ntuples
122 IConversionSvc* svc = getDataLoader( *d );
123 if ( !svc ) continue;
124
125 IDataSelector sel;
126 IDataManagerSvc::traverseSubTree( ( *d )->object(), [&sel]( IRegistry* r, int ) {
127 DataObject* obj = r->object();
128 if ( obj ) sel.push_back( obj );
129 return true;
130 } ).ignore();
131 for ( DataObject* o : reverse( sel ) ) {
132 IRegistry* r = o->registry();
133 auto status = svc->updateRep( r->address(), o );
134 if ( !status.isSuccess() ) iret = status;
135 }
136 for ( DataObject* o : reverse( sel ) ) {
137 IRegistry* r = o->registry();
138 auto status = svc->updateRepRefs( r->address(), o );
139 if ( !status.isSuccess() ) iret = status;
140 }
141
142 if ( iret.isSuccess() ) need_update += sel.size();
143 }
144 }
145 }
146 if ( !iret.isSuccess() ) {
147 error() << "ERROR while saving NTuples" << endmsg;
148 return iret;
149 }
150 if ( need_update > 0 ) { info() << "NTuples saved successfully" << endmsg; }
151 return iret;
152}
153
154// Finalize single service
156 SmartIF<IService> isvc( c.service );
157 if ( isvc ) isvc->finalize().ignore();
158 c.service->release();
159 c.service = nullptr;
160}
161
162// Close all open connections
163StatusCode NTupleSvc::disconnect( const std::string& nam ) {
164 auto i = m_connections.find( nam );
165 if ( i == m_connections.end() ) return StatusCode::FAILURE;
166 releaseConnection( i->second );
167 m_connections.erase( i );
168 return StatusCode::SUCCESS;
169}
170
171// Close all open connections
173 for ( auto& i : m_connections ) releaseConnection( i.second );
174 m_connections.clear();
175 return StatusCode::SUCCESS;
176}
177
180 StatusCode status = updateDirectories();
181 status = clearStore();
182 status = DataSvc::finalize();
183 status = disconnectAll();
184 return status;
185}
186
187StatusCode NTupleSvc::connect( const std::string& ident ) {
188 std::string logName;
189 return connect( ident, logName );
190}
191
192StatusCode NTupleSvc::connect( const std::string& ident, std::string& logname ) {
193 DataObject* pO = nullptr;
194 StatusCode status = findObject( m_rootName.value(), pO );
195 if ( status.isSuccess() ) {
196 char typ = 0;
197 std::vector<Prop> props;
198 long loc = ident.find( " " );
199 std::string filename, auth, svc = "", db_typ = "";
200 logname = ident.substr( 0, loc );
202 // we assume that there is always a " "
203 // (but if it is not there, we probably will not match the pattern)
204 for ( auto attrib : Parser( ident.substr( loc + 1 ) ) ) {
205 switch ( ::toupper( attrib.tag[0] ) ) {
206 case 'A':
207 break;
208 case 'F': // FILE='<file name>'
209 case 'D': // DATAFILE='<file name>'
210 filename = std::move( attrib.value );
211 break;
212 case 'O': // OPT='<NEW<CREATE,WRITE>, UPDATE, READ>'
213 switch ( ::toupper( attrib.value[0] ) ) {
214 case 'C':
215 case 'N':
216 case 'W':
217 typ = 'N';
218 break;
219 case 'U':
220 typ = 'U';
221 break;
222 case 'O':
223 case 'R':
224 typ = 'O';
225 break;
226 default:
227 typ = 0;
228 break;
229 }
230 break;
231 case 'T': // TYP='<HBOOK,ROOT,OBJY,...>'
232 db_typ = std::move( attrib.value );
233 break;
234 default:
235 props.emplace_back( attrib.tag, attrib.value );
236 break;
237 }
238 }
239 if ( 0 != typ ) {
240 IConversionSvc* pSvc = nullptr;
241 status = createService( name() + '.' + logname, db_typ, props, pSvc );
242 if ( status.isSuccess() ) {
243 status = attachTuple( filename, logname, typ, pSvc->repSvcType() );
244 if ( status.isSuccess() ) {
245 m_connections.insert( { m_rootName + '/' + logname, Connection( pSvc ) } );
246 return StatusCode::SUCCESS;
247 }
248 }
249 }
250 }
251 error() << "Cannot add " << ident << " invalid filename!" << endmsg;
252 return StatusCode::FAILURE;
253}
254
255StatusCode NTupleSvc::createService( const std::string& /* nam */, const std::string& typ,
256 const std::vector<Prop>& /* props */, IConversionSvc*& pSvc ) {
258 // Get the value of the Stat persistancy mechanism from the AppMgr
259 auto appPropMgr = serviceLocator()->as<IProperty>();
260 if ( !appPropMgr ) {
261 // Report an error and return the FAILURE status code
262 error() << "Could not get PropMgr" << endmsg;
263 return StatusCode::FAILURE;
264 }
265
266 Gaudi::Property<std::string> sp( "HistogramPersistency", "" );
267 StatusCode sts = appPropMgr->getProperty( &sp );
268 if ( !sts.isSuccess() ) {
269 error() << "Could not get NTuple Persistency format"
270 << " from ApplicationMgr properties" << endmsg;
271 return sts;
272 }
273
274 long storage_typ = TEST_StorageType;
275 if ( sp.value() == "HBOOK" ) {
276 storage_typ = HBOOK_StorageType;
277 } else if ( sp.value() == "ROOT" ) {
278 storage_typ = ROOT_StorageType;
279 } else {
280 error() << "Unknown NTuple Persistency format: " << sp.value() << endmsg;
281 return StatusCode::FAILURE;
282 }
283
284 if ( !typ.empty() && typ != sp.value() ) {
285 warning() << "NTuple persistency type is " << sp.value() << "." << endmsg << "Type given by job option "
286 << "NTupleSvc.Input/Output ignored!" << endmsg;
287 }
288
289 // debug() << "storage type: " << m_storageType << endmsg;
290
291 // FIXME: (MCl) why NTupleSvc has to directly create a ConversionSvc?
292 IInterface* iface = new ConversionSvc( name() + "Conversions", serviceLocator(), storage_typ );
293 auto pService = SmartIF<IService>( iface );
294 if ( !pService ) return StatusCode::FAILURE;
295
296 auto cnvSvc = pService.as<IConversionSvc>();
297 if ( !cnvSvc ) return StatusCode::FAILURE;
298
299 pSvc = cnvSvc.get();
300 pSvc->addRef(); // make sure the caller gets a pSvc which points at something
301 // with a refCount of (at least) one...
302 auto status = pService->sysInitialize();
303 if ( !status.isSuccess() ) return status;
304 return pSvc->setDataProvider( this );
305}
306
308StatusCode NTupleSvc::create( const CLID& typ, const std::string& title, NTuple::Tuple*& refpTuple ) {
309 NTuple::TupleImp* pTuple = nullptr;
311 if ( typ == CLID_ColumnWiseTuple ) {
312 pTuple = new NTuple::ColumnWiseTuple( title );
313 } else if ( typ == CLID_RowWiseTuple ) {
314 pTuple = new NTuple::RowWiseTuple( title );
315 } else {
317 }
318 if ( pTuple ) {
319 pTuple->setTupleService( this );
320 status = StatusCode::SUCCESS;
321 }
322 refpTuple = pTuple;
323 return status;
324}
325
327NTuple::Tuple* NTupleSvc::book( const std::string& fullPath, const CLID& type, const std::string& title ) {
328 DataObject* pObj = nullptr;
329 std::string path = fullPath;
330 assert( !path.empty() );
331 if ( path[0] != SEPARATOR ) {
332 path = m_rootName;
333 path += SEPARATOR;
334 path += fullPath;
335 }
336 StatusCode status = retrieveObject( path, pObj );
337 if ( status.isSuccess() ) {
338 error() << "Cannot book N-tuple " << path << " (Exists already)" << endmsg;
339 return nullptr;
340 }
341 auto sep = path.rfind( SEPARATOR );
342 if ( sep == std::string::npos ) {
343 error() << "Cannot book N-tuple " << path << " (Invalid path)" << endmsg;
344 return nullptr;
345 }
346
347 std::string p_path( path, 0, sep );
348 std::string o_path( path, sep, path.length() );
349 DataObject* dir = createDirectory( p_path );
350 if ( !dir ) {
351 error() << "Cannot book N-tuple " << path << " (Invalid parent directory)" << endmsg;
352 return nullptr;
353 }
354
355 NTuple::Tuple* tup = book( dir, o_path, type, title );
356 if ( !tup ) { error() << "Cannot book N-tuple " << path << " (Unknown reason)" << endmsg; }
357 return tup;
358}
359
361NTuple::Tuple* NTupleSvc::book( const std::string& dirPath, const std::string& relPath, const CLID& type,
362 const std::string& title ) {
363 std::string full = dirPath;
364 assert( !relPath.empty() );
365 if ( relPath[0] != SEPARATOR ) full += SEPARATOR;
366 full += relPath;
367 return book( full, type, title );
368}
369
371NTuple::Tuple* NTupleSvc::book( const std::string& dirPath, long id, const CLID& type, const std::string& title ) {
372 return book( dirPath, std::to_string( id ), type, title );
373}
374
376NTuple::Tuple* NTupleSvc::book( DataObject* pParent, const std::string& relPath, const CLID& type,
377 const std::string& title ) {
378 NTuple::Tuple* pObj = nullptr;
379 // Check if object is already present
380 StatusCode status = findObject( pParent, relPath, *pp_cast<DataObject>( &pObj ) );
381 // No ? Then create it!
382 if ( !status.isSuccess() ) {
383 status = create( type, title, pObj );
384 if ( status.isSuccess() ) {
385 // Finally register the created N tuple with the store
386 status = registerObject( pParent, relPath, pObj );
387 if ( status.isSuccess() ) return pObj;
388 pObj->release();
389 }
390 }
391 return nullptr;
392}
393
395NTuple::Tuple* NTupleSvc::book( DataObject* pParent, long id, const CLID& type, const std::string& title ) {
396 return book( pParent, std::to_string( id ), type, title );
397}
398
400NTuple::Directory* NTupleSvc::createDirectory( DataObject* pParent, const std::string& relPath ) {
401 assert( !relPath.empty() );
402 if ( pParent ) {
403 IRegistry* pDir = pParent->registry();
404 if ( pDir ) {
405 std::string full = pDir->identifier();
406 if ( relPath[0] != '/' ) full += "/";
407 full += relPath;
408 return createDirectory( full );
409 }
410 }
411 return nullptr;
412}
413
416 return createDirectory( pParent, std::to_string( id ) );
417}
418
420NTuple::Directory* NTupleSvc::createDirectory( const std::string& dirPath, long id ) {
421 return createDirectory( dirPath, std::to_string( id ) );
422}
423
425NTuple::Directory* NTupleSvc::createDirectory( const std::string& dirPath, const std::string& relPath ) {
426 assert( !relPath.empty() );
427 std::string full = dirPath;
428 if ( relPath[0] != '/' ) full += "/";
429 full += relPath;
430 return createDirectory( full );
431}
432
433StatusCode NTupleSvc::attachTuple( const std::string& filename, const std::string& logname, const char typ,
434 const long t ) {
435 DataObject* p;
436 // First get the root object
437 StatusCode status = retrieveObject( m_rootName.value(), p );
438 if ( status.isSuccess() ) {
439 // Now add the registry entry to the store
440 std::string entryname = m_rootName;
441 entryname += '/';
442 entryname += logname;
443 GenericAddress* pA = new GenericAddress( t, CLID_NTupleFile, filename, entryname, 0, typ );
444 status = registerAddress( p, logname, pA );
445 if ( status.isSuccess() ) {
446 info() << "Added stream file:" << filename << " as " << logname << endmsg;
447 return status;
448 }
449 pA->release();
450 }
451 error() << "Cannot add file:" << filename << " as " << logname << endmsg;
452 return status;
453}
454
456NTuple::Directory* NTupleSvc::createDirectory( const std::string& fullPath ) {
457 NTuple::Directory* p = nullptr;
458 StatusCode status = findObject( fullPath, *pp_cast<DataObject>( &p ) );
459 if ( !status.isSuccess() ) {
460 auto sep2 = fullPath.rfind( SEPARATOR );
461 if ( sep2 != std::string::npos ) {
462 std::string relPath = fullPath.substr( 0, sep2 );
463 p = createDirectory( relPath );
464 if ( p ) {
465 p = new NTuple::Directory();
466 // Finally register the created N tuple with the store
467 status = registerObject( fullPath, p );
468 if ( status.isSuccess() ) {
469 // ...starting from the file entries
471 if ( svc ) {
472 IOpaqueAddress* pAddr = nullptr;
473 status = svc->createRep( p, pAddr );
474 if ( status.isSuccess() ) {
475 p->registry()->setAddress( pAddr );
476 status = svc->fillRepRefs( pAddr, p );
477 if ( status.isSuccess() ) return p;
478 }
479 }
480 unregisterObject( p ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
481 }
482 p->release();
483 p = nullptr;
484 }
485 }
486 }
487 return p;
488}
489
491NTuple::Tuple* NTupleSvc::access( const std::string&, const std::string& ) { return nullptr; }
492
494StatusCode NTupleSvc::save( const std::string& fullPath ) {
495 NTuple::Tuple* pObj = nullptr;
496 StatusCode status = findObject( fullPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
497 return status.isSuccess() ? save( pObj ) : Status::INVALID_OBJ_PATH;
498}
499
502 NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
503 if ( tuple ) {
504 try {
505 IConversionSvc* pSvc = tuple->conversionService();
506 IRegistry* pReg = tuple->registry();
507 if ( pSvc && pReg ) {
508 IOpaqueAddress* pAddr = pReg->address();
509 StatusCode sc = pSvc->updateRep( pAddr, n_tuple );
510 if ( sc.isSuccess() ) sc = pSvc->updateRepRefs( pAddr, n_tuple );
511 return sc;
512 }
513 return Status::NO_DATA_LOADER;
514 } catch ( ... ) {}
515 }
516 return Status::INVALID_OBJECT;
517}
518
520StatusCode NTupleSvc::save( DataObject* pParent, const std::string& relPath ) {
521 NTuple::Tuple* pObj = nullptr;
522 StatusCode status = findObject( pParent, relPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
523 return status.isSuccess() ? save( pObj ) : Status::INVALID_OBJ_PATH;
524}
525
528 NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
529 if ( tuple ) {
530 try {
531 IConversionSvc* pSvc = tuple->conversionService();
532 if ( !pSvc ) {
533 pSvc = getDataLoader( n_tuple->registry() );
534 tuple->setConversionService( pSvc );
535 }
536 if ( pSvc ) {
537 IRegistry* pReg = n_tuple->registry();
538 IOpaqueAddress* pAddr = pReg->address();
539 StatusCode status = pSvc->createRep( n_tuple, pAddr );
540 if ( status.isSuccess() ) {
541 pReg->setAddress( pAddr );
542 status = pSvc->fillRepRefs( pAddr, n_tuple );
543 }
544 return status;
545 }
546 return Status::NO_DATA_LOADER;
547 } catch ( ... ) {}
548 }
549 return Status::INVALID_OBJECT;
550}
551
553StatusCode NTupleSvc::writeRecord( const std::string& fullPath ) {
554 NTuple::Tuple* pObj = nullptr;
555 StatusCode status = findObject( fullPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
556 return status.isSuccess() ? writeRecord( pObj ) : Status::INVALID_OBJ_PATH;
557}
558
560StatusCode NTupleSvc::writeRecord( DataObject* pParent, const std::string& relPath ) {
561 NTuple::Tuple* pObj = nullptr;
562 StatusCode status = findObject( pParent, relPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
563 return status.isSuccess() ? writeRecord( pObj ) : Status::INVALID_OBJ_PATH;
564}
565
568 StatusCode status = Status::INVALID_OBJECT;
569 NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
570 if ( tuple ) {
571 try {
572 IConversionSvc* pSvc = tuple->conversionService();
573 if ( !pSvc ) {
574 pSvc = getDataLoader( n_tuple->registry() );
575 tuple->setConversionService( pSvc );
576 }
577 if ( pSvc ) {
578 IRegistry* pReg = n_tuple->registry();
579 IOpaqueAddress* pAddr = pReg->address();
580 status = pSvc->updateObj( pAddr, n_tuple );
581 if ( status.isSuccess() ) { status = pSvc->updateObjRefs( pAddr, n_tuple ); }
582 return status;
583 }
584 status = Status::NO_DATA_LOADER;
585 } catch ( ... ) { status = Status::INVALID_OBJECT; }
586 }
587 return status;
588}
589
591StatusCode NTupleSvc::readRecord( const std::string& fullPath ) {
592 NTuple::Tuple* pObj = nullptr;
593 StatusCode status = findObject( fullPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
594 return status.isSuccess() ? readRecord( pObj ) : Status::INVALID_OBJ_PATH;
595}
596
598StatusCode NTupleSvc::readRecord( DataObject* pParent, const std::string& relPath ) {
599 NTuple::Tuple* pObj = nullptr;
600 StatusCode status = findObject( pParent, relPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
601 return status.isSuccess() ? readRecord( pObj ) : Status::INVALID_OBJ_PATH;
602}
const long HBOOK_StorageType
Definition ClassID.h:64
unsigned int CLID
Class ID definition.
Definition ClassID.h:16
const long TEST_StorageType
Definition ClassID.h:57
const long ROOT_StorageType
Definition ClassID.h:60
void toupper(std::string &s)
std::vector< DataObject * > IDataSelector
This is only a placeholder to allow me compiling until the responsible guy does his work!
DEST ** pp_cast(SRC **ptr)
Small function to be used instead of the construct (void**)&pointer, which produces,...
Definition IInterface.h:370
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
#define DECLARE_NAMESPACE_OBJECT_FACTORY(n, x)
#define DECLARE_COMPONENT(type)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Base class for all conversion services.
A DataObject is the base class of any identifiable object on any data store.
Definition DataObject.h:37
IRegistry * registry() const
Get pointer to Registry.
Definition DataObject.h:79
virtual unsigned long release()
release reference to object
StatusCode setRoot(std::string root_name, DataObject *pRootObj) override
Initialize data store for new event by giving new event path and root object.
Definition DataSvc.cpp:115
StatusCode finalize() override
Service initialization.
Definition DataSvc.cpp:828
Gaudi::Property< std::string > m_rootName
Definition DataSvc.h:53
StatusCode findObject(std::string_view fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition DataSvc.cpp:623
StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves) override
IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
Definition DataSvc.cpp:181
StatusCode initialize() override
Service initialization.
Definition DataSvc.cpp:795
StatusCode unregisterObject(std::string_view fullPath) override
Unregister object from the data store.
Definition DataSvc.cpp:356
StatusCode registerObject(std::string_view parentPath, std::string_view objPath, DataObject *pObject) override
Register object with the data store.
Definition DataSvc.cpp:276
Gaudi::Property< CLID > m_rootCLID
Definition DataSvc.h:52
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
Retrieve object from data store.
Definition DataSvc.cpp:601
StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition DataSvc.cpp:198
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition DataSvc.cpp:85
Implementation of property with value of concrete type.
Definition PropertyFwd.h:27
Parse attribute strings allowing iteration over the various attributes.
Generic Transient Address.
unsigned long release() override
release reference to object
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an already converted object.
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the converted representation of a transient object.
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
Definition of the basic interface.
Definition IInterface.h:225
virtual unsigned long addRef() const =0
Increment the reference count of Interface instance.
Opaque address interface definition.
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
The IProperty is the basic interface for all components which have properties that can be set or get.
Definition IProperty.h:32
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition IRegistry.h:29
virtual const id_type & identifier() const =0
Full identifier (or key)
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual void setAddress(IOpaqueAddress *pAddress)=0
Set/Update Opaque storage address.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition ISvcLocator.h:42
SmartIF< IFace > as()
Definition ISvcLocator.h:64
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition NTuple.h:380
IConversionSvc * conversionService() const
Access conversion service.
void setTupleService(INTupleSvc *svc)
Access conversion service.
void setConversionService(IConversionSvc *svc)
Access conversion service.
NTuple service.
Definition NTupleSvc.h:32
NTuple::Directory * createDirectory(DataObject *pParent, const std::string &title) override
Create Ntuple directory and register it with the data store.
Gaudi::Property< DBaseEntries > m_output
Definition NTupleSvc.h:125
StatusCode initialize() override
DataSvc overrides: Initialize the service.
Definition NTupleSvc.cpp:67
bool isConnected(const std::string &identifier) const override
Check if a datasource is connected.
Definition NTupleSvc.cpp:89
NTuple::Tuple * access(const std::string &fullPath, const std::string &filename) override
Access N tuple on disk.
NTupleSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition NTupleSvc.cpp:61
StatusCode attachTuple(const std::string &filename, const std::string &logname, const char typ, const long t)
Attach output/input file.
StatusCode disconnect(const std::string &nam) override
Close open connection.
Gaudi::Property< DBaseEntries > m_input
Definition NTupleSvc.h:124
StatusCode connect(const std::string &ident) override
Add file to list I/O list.
StatusCode finalize() override
DataSvc overrides: stop the service.
NTuple::Tuple * book(const std::string &fullPath, const CLID &type, const std::string &title) override
Book Ntuple and register it with the data store.
StatusCode disconnectAll() override
Close all open connections.
StatusCode reinitialize() override
DataSvc overrides: reinitialize service.
Definition NTupleSvc.cpp:86
StatusCode updateDirectories()
Update directory data.
StatusCode create(const CLID &typ, const std::string &title, NTuple::Tuple *&refpTuple) override
Create requested N tuple (Hide constructor)
IConversionSvc * getDataLoader(IRegistry *pReg) override
DataSvc overrides: Retrieve data loader.
Definition NTupleSvc.cpp:95
void releaseConnection(Connection &c)
Finalize single service.
StatusCode save(const std::string &fullPath) override
Save N tuple to disk. Must be called in order to close the ntuple file properly.
std::map< std::string, Connection > m_connections
Container of connection points.
Definition NTupleSvc.h:129
StatusCode readRecord(NTuple::Tuple *tuple) override
Read single record from N tuple.
StatusCode writeRecord(NTuple::Tuple *tuple) override
Write single record to N tuple.
StatusCode createService(const std::string &nam, const std::string &typ, const std::vector< Prop > &props, IConversionSvc *&pSvc)
Create conversion service.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition Service.cpp:336
const std::string & name() const override
Retrieve name of the service.
Definition Service.cpp:333
Small smart pointer class with automatic reference counting for IInterface.
Definition SmartIF.h:28
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition StatusCode.h:139
bool isSuccess() const
Definition StatusCode.h:314
constexpr static const auto SUCCESS
Definition StatusCode.h:99
constexpr static const auto FAILURE
Definition StatusCode.h:100
NTuple name space.
Definition INTupleSvc.h:16
STL namespace.
::details::reverse_wrapper< T > reverse(T &&iterable)
Definition reverse.h:58
virtual StatusCode traverseSubTree(std::string_view sub_tree_path, IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects below the sub tree identified by its full path name.
Small class representing an N tuple directory in the transient store.
Definition NTuple.h:906