|
Gaudi Framework, version v22r2 |
| Home | Generated: Tue May 10 2011 |
Statistics file converter class definition. More...
#include <PoolDb/PoolDbDatabaseCnv.h>


Public Member Functions | |
| PoolDbDatabaseCnv (long typ, const CLID &, ISvcLocator *svc) | |
| Initializing Constructor. | |
| virtual | ~PoolDbDatabaseCnv () |
| 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 Database file. Wether this is a real file or only a connection to a database depends on the underlying engine.
Definition at line 26 of file PoolDbDatabaseCnv.h.
| PoolDbDatabaseCnv::PoolDbDatabaseCnv | ( | long | typ, |
| const CLID & | , | ||
| ISvcLocator * | svc | ||
| ) |
Initializing Constructor.
| typ | [IN] Concrete storage type of the converter |
| svc | [IN] Pointer to service locator object |
| PoolDbDatabaseCnv::~PoolDbDatabaseCnv | ( | ) | [virtual] |
| virtual const std::string PoolDbDatabaseCnv::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 PoolDbStatCnv.
Definition at line 45 of file PoolDbDatabaseCnv.h.
{
return "<local>";
}
| StatusCode PoolDbDatabaseCnv::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 PoolDbDirectoryCnv.
Definition at line 35 of file PoolDbDatabaseCnv.cpp.
{
StatusCode status = StatusCode::FAILURE;
MsgStream log(msgSvc(), "PoolDbDatabaseCnv");
if ( pAddr ) {
IRegistry* pReg = pAddr->registry();
const unsigned long* ipars = pAddr->ipar();
const std::string* spars = pAddr->par();
char mode = char(ipars[1]);
pool::Guid guid(pool::Guid::null());
std::string fname = spars[0];
std::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;
guid.Data1 = objType();
std::string cntName = containerName(pReg);
if ( create ) {
status = saveDescription(fname, cntName, "File containing statistics results.",
"", guid, clid, "NEW");
if ( status.isSuccess() ) {
log << MSG::INFO << "Opened NEW Database file:"
<< fname << " as " << oname << endmsg;
}
}
else if ( update ) {
status = saveDescription(fname, cntName, "File containing statistics results.",
"", guid, clid, "UPDATE");
if ( status.isSuccess() ) {
log << MSG::INFO << "Connect to existing Database file:"
<< fname << " as " << oname << " for UPDATE" << endmsg;
}
}
else if ( read ) {
if ( status.isSuccess() ) {
log << MSG::INFO << "Connect to existing Database file:"
<< fname << " as " << oname << " for READ" << endmsg;
}
}
else if ( recrea ) {
status = saveDescription(fname, cntName, "File containing statistics results.",
"", guid, clid, "RECREATE");
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;
}