The Gaudi Framework  master (594c33fa)
Gaudi::RootDatabaseCnv Class Reference

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

Additional Inherited Members

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

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 38 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 ) {}

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 54 of file RootDatabaseCnv.h.

54 { 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  {
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 ) {
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 ) {
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 ) {
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 }

The documentation for this class was generated from the following files:
NTuple::File
Small class representing an N tuple file in the transient store.
Definition: NTuple.h:922
IOpaqueAddress::par
virtual const std::string * par() const =0
Retrieve String parameters.
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:314
MSG::INFO
@ INFO
Definition: IMessageSvc.h:25
Gaudi::RootCnvSvc::connectDatabase
StatusCode connectDatabase(const std::string &dataset, int mode, RootDataConnection **con)
Connect the output file to the service with open mode.
Definition: RootCnvSvc.cpp:210
Gaudi::RootConverter::m_dbMgr
RootCnvSvc * m_dbMgr
Conversion service needed for proper operation to forward requests.
Definition: RootConverter.h:45
Gaudi::IDataConnection::RECREATE
@ RECREATE
Definition: IIODataManager.h:49
IRegistry
Definition: IRegistry.h:32
Gaudi::RootDataConnection
Definition: RootDataConnection.h:112
Gaudi::RootDatabaseCnv::containerName
const std::string containerName(IRegistry *) const override
Retrieve the name of the container a given object is placed into.
Definition: RootDatabaseCnv.h:54
Gaudi::IDataConnection::CREATE
@ CREATE
Definition: IIODataManager.h:49
IRegistry::name
virtual const name_type & name() const =0
Name of the directory (or key)
StatusCode
Definition: StatusCode.h:65
Gaudi::RootStatCnv::saveDescription
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.
Definition: RootStatCnv.cpp:109
Gaudi::IDataConnection::UPDATE
@ UPDATE
Definition: IIODataManager.h:49
Gaudi::IDataConnection::READ
@ READ
Definition: IIODataManager.h:49
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:203
Converter::objType
const CLID & objType() const override
Retrieve the class type of objects the converter produces.
Definition: Converter.cpp:23
IOpaqueAddress::registry
virtual IRegistry * registry() const =0
Update branch name.
StatusCode::ignore
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition: StatusCode.h:139
Gaudi::RootStatCnv::log
MsgStream & log() const
Helper to use mesage logger.
Definition: RootStatCnv.h:48
hivetimeline.read
def read(f, regex=".*", skipevents=0)
Definition: hivetimeline.py:32
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
GaudiPython.Pythonizations.update
update
Definition: Pythonizations.py:145
MSG::ERROR
@ ERROR
Definition: IMessageSvc.h:25
NTuple::File::setOpen
void setOpen(bool flag)
Set "open" flag.
Definition: NTuple.h:956
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
Gaudi::RootDirectoryCnv::RootDirectoryCnv
RootDirectoryCnv(long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
Initializing Constructor.
Definition: RootDirectoryCnv.cpp:40
IOpaqueAddress::ipar
virtual const unsigned long * ipar() const =0
Access to generic link parameters.