|
Gaudi Framework, version v23r2 |
| Home | Generated: Thu Jun 28 2012 |
Statistics file converter class definition. More...
#include <Root/RootDatabaseCnv.h>


Public Member Functions | |
| RootDatabaseCnv (long typ, const CLID &, ISvcLocator *svc, RootCnvSvc *mgr) | |
| Initializing Constructor. | |
| virtual | ~RootDatabaseCnv () |
| Standard destructor. | |
| virtual const std::string | containerName (IRegistry *) const |
| Retrieve the name of the container a given object is placed into. | |
| virtual StatusCode | createObj (IOpaqueAddress *pAddr, DataObject *&refpObj) |
| Converter overrides: Create transient object from persistent data. | |
Statistics file converter class definition.
Description: Definition of the converter to open root database files.
Definition at line 29 of file RootDatabaseCnv.h.
| RootDatabaseCnv::RootDatabaseCnv | ( | long | typ, |
| const CLID & | cl, | ||
| ISvcLocator * | svc, | ||
| RootCnvSvc * | mgr | ||
| ) |
Initializing Constructor.
| typ | [IN] Concrete storage type of the converter |
| svc | [IN] Pointer to service locator object |
| mgr | [IN] Pointer to hosting conversion service |
Definition at line 28 of file RootDatabaseCnv.cpp.
: RootDirectoryCnv(typ, cl, svc, mgr) { }
| RootDatabaseCnv::~RootDatabaseCnv | ( | ) | [virtual] |
| virtual const std::string Gaudi::RootDatabaseCnv::containerName | ( | IRegistry * | ) | const [inline, virtual] |
Retrieve the name of the container a given object is placed into.
| pReg | [IN] Pointer to registry entry. |
Reimplemented from Gaudi::RootStatCnv.
Definition at line 49 of file RootDatabaseCnv.h.
{
return "<local>";
}
| StatusCode RootDatabaseCnv::createObj | ( | IOpaqueAddress * | pAddr, |
| DataObject *& | refpObj | ||
| ) | [virtual] |
Converter overrides: Create transient object from persistent data.
| refpAddress | [IN] Pointer to object address. |
| refpObject | [OUT] Location to pointer to store data object |
Reimplemented from Gaudi::RootDirectoryCnv.
Definition at line 39 of file RootDatabaseCnv.cpp.
{
StatusCode status = StatusCode::FAILURE;
if ( pAddr ) {
RootDataConnection* con = 0;
IRegistry* pReg = pAddr->registry();
const unsigned long* ipars = pAddr->ipar();
const string* spars = pAddr->par();
char mode = char(ipars[1]);
string fname = spars[0];
string oname = pReg->name();
bool recrea = mode == 'R';
bool create = mode == 'N';
bool update = mode == 'U';
bool read = mode == 'O';
const CLID& clid = objType();
status = StatusCode::SUCCESS;
string cntName = containerName(pReg);
if ( create ) {
m_dbMgr->connectDatabase(fname,IDataConnection::CREATE,&con).ignore();
status = saveDescription(fname, cntName, "File containing statistics results.","", clid);
if ( status.isSuccess() ) {
log() << MSG::INFO << "Opened NEW Database file:"
<< fname << " as " << oname << endmsg;
}
}
else if ( update ) {
m_dbMgr->connectDatabase(fname,IDataConnection::UPDATE,&con).ignore();
status = saveDescription(fname, cntName, "File containing statistics results.","", clid);
if ( status.isSuccess() ) {
log() << MSG::INFO << "Connect to existing Database file:"
<< fname << " as " << oname << " for UPDATE" << endmsg;
}
}
else if ( read ) {
status = m_dbMgr->connectDatabase(fname,IDataConnection::READ,&con);
if ( status.isSuccess() ) {
log() << MSG::INFO << "Connect to existing Database file:"
<< fname << " as " << oname << " for READ" << endmsg;
}
}
else if ( recrea ) {
m_dbMgr->connectDatabase(fname,IDataConnection::RECREATE,&con).ignore();
status = saveDescription(fname, cntName, "File containing statistics results.","", clid);
if ( status.isSuccess() ) {
log() << MSG::INFO << "Recreate Database file:" << fname << " as " << oname << endmsg;
}
}
else {
log() << MSG::ERROR << "Don't know what to do:" << fname << endmsg;
status = StatusCode::FAILURE;
}
// Now create object
if ( status.isSuccess() ) {
NTuple::File* pFile = new NTuple::File(objType(), fname, oname);
pFile->setOpen(false);
refpObj = pFile;
}
}
return status;
}