The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
Gaudi::RootDatabaseCnv Class Reference

Statistics file converter class definition. More...

#include <Root/RootDatabaseCnv.h>

Inheritance diagram for Gaudi::RootDatabaseCnv:
Collaboration diagram for Gaudi::RootDatabaseCnv:

Public Member Functions

 RootDatabaseCnv (long typ, const CLID &, ISvcLocator *svc, RootCnvSvc *mgr)
 Initializing Constructor.
 
const std::string containerName (IRegistry *) const override
 Retrieve the name of the container a given object is placed into.
 
StatusCode createObj (IOpaqueAddress *pAddr, DataObject *&refpObj) override
 Converter overrides: Create transient object from persistent data.
 
- Public Member Functions inherited from Gaudi::RootDirectoryCnv
 RootDirectoryCnv (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
 Initializing Constructor.
 
StatusCode createObj (IOpaqueAddress *pAddr, DataObject *&refpObj) override
 Converter overrides: Create transient object from persistent data.
 
StatusCode fillObjRefs (IOpaqueAddress *pAddr, DataObject *pObj) override
 Converter overrides: Resolve the references of the transient object.
 
StatusCode updateObj (IOpaqueAddress *pAddr, DataObject *pObj) override
 Converter overrides: Update transient object from persistent data.
 
StatusCode updateObjRefs (IOpaqueAddress *pAddr, DataObject *pObj) override
 Converter overrides: Update the references of an updated transient object.
 
StatusCode createRep (DataObject *pObj, IOpaqueAddress *&refpAddr) override
 Converter overrides: Convert the transient object to the requested representation.
 
StatusCode fillRepRefs (IOpaqueAddress *pAddr, DataObject *pObj) override
 Converter overrides: Fill references of persistent object representation.
 
StatusCode updateRep (IOpaqueAddress *pAddr, DataObject *pObj) override
 Converter overrides: Update persistent object representation.
 
StatusCode updateRepRefs (IOpaqueAddress *pAddr, DataObject *pObj) override
 Converter overrides: Update references of persistent object representation.
 
- Public Member Functions inherited from Gaudi::RootStatCnv
 RootStatCnv (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
 Initializing Constructor.
 
- Public Member Functions inherited from Gaudi::RootConverter
 RootConverter (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
 Initializing Constructor.
 
long repSvcType () const override
 Retrieve the class type of the data store the converter uses.
 
StatusCode createObj (IOpaqueAddress *pAddr, DataObject *&refpObj) override
 Converter overrides: Create transient object from persistent data.
 
StatusCode fillObjRefs (IOpaqueAddress *pAddr, DataObject *pObj) override
 Resolve the references of the created transient object.
 
StatusCode createRep (DataObject *pObj, IOpaqueAddress *&refpAddr) override
 Converter overrides: Convert the transient object to the requested representation.
 
StatusCode fillRepRefs (IOpaqueAddress *pAddr, DataObject *pObj) override
 Resolve the references of the created transient object.
 
- Public Member Functions inherited from Converter
StatusCode initialize () override
 Initialize the converter.
 
StatusCode finalize () override
 Initialize the converter.
 
StatusCode setDataProvider (IDataProviderSvc *svc) override
 Set Data provider service.
 
SmartIF< IDataProviderSvc > & dataProvider () const override
 Get Data provider service.
 
StatusCode setConversionSvc (IConversionSvc *svc) override
 Set conversion service the converter is connected to.
 
SmartIF< IConversionSvc > & conversionSvc () const override
 Get conversion service the converter is connected to.
 
StatusCode setAddressCreator (IAddressCreator *creator) override
 Set address creator facility.
 
SmartIF< IAddressCreator > & addressCreator () const override
 Retrieve address creator facility.
 
const CLIDobjType () const override
 Retrieve the class type of objects the converter produces.
 
virtual long i_repSvcType () const
 Retrieve the class type of the data store the converter uses.
 
StatusCode createObj (IOpaqueAddress *pAddress, DataObject *&refpObject) override
 Create the transient representation of an object.
 
StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Resolve the references of the created transient object.
 
StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *refpObject) override
 Update the transient object from the other representation.
 
StatusCode updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Update the references of an updated transient object.
 
StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress) override
 Convert the transient object to the requested representation.
 
StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Resolve the references of the converted object.
 
StatusCode updateRep (IOpaqueAddress *pAddress, DataObject *pObject) override
 Update the converted representation of a transient object.
 
StatusCode updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
 Update the references of an already converted object.
 
 Converter (long storage_type, const CLID &class_type, ISvcLocator *svc=0)
 Standard Constructor.
 
SmartIF< IServiceservice (const std::string &name, const bool createIf=true) const
 Return a pointer to the service identified by name (or "type/name")
 
- Public Member Functions inherited from implements< IConverter >
void const * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast.
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface.
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames.
 
 implements ()=default
 Default constructor.
 
 implements (const implements &)
 Copy constructor (zero the reference count)
 
implementsoperator= (const implements &)
 Assignment operator (do not touch the reference count).
 
unsigned long addRef () const override
 Reference Interface instance.
 
unsigned long release () const override
 Release Interface instance.
 
unsigned long refCount () const override
 Current reference count.
 

Additional Inherited Members

- Public Types inherited from Converter
using Factory = Gaudi::PluginService::Factory<IConverter*( ISvcLocator* )>
 
- Public Types inherited from implements< IConverter >
using base_class
 Typedef to this class.
 
using extend_interfaces_base
 Typedef to the base of this class.
 
using iids
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids
 take union of the ext_iids of all Interfaces...
 
- Protected Member Functions inherited from Gaudi::RootStatCnv
MsgStreamlog () const
 Helper to use mesage logger.
 
StatusCode initialize () override
 Initialize converter object.
 
StatusCode finalize () override
 Finalize converter object.
 
virtual const std::string fileName (IRegistry *pReg) const
 Retrieve the name of the file a given object is placed into.
 
virtual const std::string topLevel (IRegistry *pReg) const
 Retrieve the full path of the file a given object is placed into.
 
StatusCode makeError (const std::string &msg, bool throw_exception=false) const
 Helper method to issue error messages.
 
StatusCode saveDescription (const std::string &path, const std::string &ident, const std::string &desc, const std::string &opt, const CLID &clid)
 Save statistics object description.
 
- Protected Member Functions inherited from Converter
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator.
 
SmartIF< IMessageSvc > & msgSvc () const
 Retrieve pointer to message service.
 
SmartIF< IDataManagerSvc > & dataManager () const
 Get Data Manager service.
 
- Protected Member Functions inherited from implements< IConverter >
unsigned long decRef () const override
 
- Protected Attributes inherited from Gaudi::RootStatCnv
SmartIF< IDataManagerSvcm_dataMgr
 Reference to data manager service to manipulate the TES.
 
std::unique_ptr< MsgStreamm_log
 Reference to logger object.
 
- Protected Attributes inherited from Gaudi::RootConverter
RootCnvSvcm_dbMgr
 Conversion service needed for proper operation to forward requests.
 
- Protected Attributes inherited from implements< IConverter >
std::atomic_ulong m_refCount
 Reference counter.
 

Detailed Description

Statistics file converter class definition.

Description: Definition of the converter to open root database files.

Author
M.Frank
Version
1.0

Definition at line 37 of file RootDatabaseCnv.h.

Constructor & Destructor Documentation

◆ RootDatabaseCnv()

RootDatabaseCnv::RootDatabaseCnv ( long typ,
const CLID & cl,
ISvcLocator * svc,
RootCnvSvc * mgr )

Initializing Constructor.

Parameters
typ[IN] Concrete storage type of the converter
svc[IN] Pointer to service locator object
mgr[IN] Pointer to hosting conversion service
Returns
Reference to RootDatabaseCnv object

Definition at line 35 of file RootDatabaseCnv.cpp.

36 : RootDirectoryCnv( typ, cl, svc, mgr ) {}
RootDirectoryCnv(long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
Initializing Constructor.

Member Function Documentation

◆ containerName()

const std::string Gaudi::RootDatabaseCnv::containerName ( IRegistry * ) const
inlineoverridevirtual

Retrieve the name of the container a given object is placed into.

Parameters
pReg[IN] Pointer to registry entry.
Returns
Name of the container the object should be put to.

Reimplemented from Gaudi::RootStatCnv.

Definition at line 53 of file RootDatabaseCnv.h.

53{ return "<local>"; }

◆ createObj()

StatusCode RootDatabaseCnv::createObj ( IOpaqueAddress * pAddr,
DataObject *& refpObj )
override

Converter overrides: Create transient object from persistent data.

Parameters
refpAddress[IN] Pointer to object address.
refpObject[OUT] Location to pointer to store data object
Returns
Status code indicating success or failure.

Definition at line 39 of file RootDatabaseCnv.cpp.

39 {
40 StatusCode status = StatusCode::FAILURE;
41 if ( pAddr ) {
42 RootDataConnection* con = nullptr;
43 IRegistry* pReg = pAddr->registry();
44 const unsigned long* ipars = pAddr->ipar();
45 const string* spars = pAddr->par();
46 char mode = char( ipars[1] );
47 string fname = spars[0];
48 auto oname = pReg->name();
49 bool recrea = mode == 'R';
50 bool create = mode == 'N';
51 bool update = mode == 'U';
52 bool read = mode == 'O';
53 const CLID& clid = objType();
54 status = StatusCode::SUCCESS;
55 string cntName = containerName( pReg );
56 if ( create ) {
57 m_dbMgr->connectDatabase( fname, IDataConnection::CREATE, &con ).ignore();
58 status = saveDescription( fname, cntName, "File containing statistics results.", "", clid );
59 if ( status.isSuccess() ) {
60 log() << MSG::INFO << "Opened NEW Database file:" << fname << " as " << oname << endmsg;
61 }
62 } else if ( update ) {
63 m_dbMgr->connectDatabase( fname, IDataConnection::UPDATE, &con ).ignore();
64 status = saveDescription( fname, cntName, "File containing statistics results.", "", clid );
65 if ( status.isSuccess() ) {
66 log() << MSG::INFO << "Connect to existing Database file:" << fname << " as " << oname << " for UPDATE"
67 << endmsg;
68 }
69 } else if ( read ) {
70 status = m_dbMgr->connectDatabase( fname, IDataConnection::READ, &con );
71 if ( status.isSuccess() ) {
72 log() << MSG::INFO << "Connect to existing Database file:" << fname << " as " << oname << " for READ" << endmsg;
73 }
74 } else if ( recrea ) {
75 m_dbMgr->connectDatabase( fname, IDataConnection::RECREATE, &con ).ignore();
76 status = saveDescription( fname, cntName, "File containing statistics results.", "", clid );
77 if ( status.isSuccess() ) {
78 log() << MSG::INFO << "Recreate Database file:" << fname << " as " << oname << endmsg;
79 }
80 } else {
81 log() << MSG::ERROR << "Don't know what to do:" << fname << endmsg;
82 status = StatusCode::FAILURE;
83 }
84 // Now create object
85 if ( status.isSuccess() ) {
86 NTuple::File* pFile = new NTuple::File( objType(), fname, oname );
87 pFile->setOpen( false );
88 refpObj = pFile;
89 }
90 }
91 return status;
92}
unsigned int CLID
Class ID definition.
Definition ClassID.h:16
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
const CLID & objType() const override
Retrieve the class type of objects the converter produces.
Definition Converter.cpp:22
RootCnvSvc * m_dbMgr
Conversion service needed for proper operation to forward requests.
const std::string containerName(IRegistry *) const override
Retrieve the name of the container a given object is placed into.
StatusCode saveDescription(const std::string &path, const std::string &ident, const std::string &desc, const std::string &opt, const CLID &clid)
Save statistics object description.
MsgStream & log() const
Helper to use mesage logger.
Definition RootStatCnv.h:47
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
virtual const std::string * par() const =0
Retrieve String parameters.
virtual IRegistry * registry() const =0
Update branch name.
virtual const name_type & name() const =0
Name of the directory (or key)
void setOpen(bool flag)
Set "open" flag.
Definition NTuple.h:949
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
@ ERROR
Definition IMessageSvc.h:22
@ INFO
Definition IMessageSvc.h:22
read(f, regex=".*", skipevents=0)

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