|
Gaudi Framework, version v21r9 |
| Home | Generated: 3 May 2010 |
#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. | |
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.
| 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.
00035 { 00036 StatusCode status = StatusCode::FAILURE; 00037 MsgStream log(msgSvc(), "PoolDbDatabaseCnv"); 00038 if ( pAddr ) { 00039 IRegistry* pReg = pAddr->registry(); 00040 const unsigned long* ipars = pAddr->ipar(); 00041 const std::string* spars = pAddr->par(); 00042 char mode = char(ipars[1]); 00043 pool::Guid guid(pool::Guid::null()); 00044 std::string fname = spars[0]; 00045 std::string oname = pReg->name(); 00046 bool recrea = mode == 'R'; 00047 bool create = mode == 'N'; 00048 bool update = mode == 'U'; 00049 bool read = mode == 'O'; 00050 const CLID& clid = objType(); 00051 status = StatusCode::SUCCESS; 00052 guid.Data1 = objType(); 00053 std::string cntName = containerName(pReg); 00054 if ( create ) { 00055 status = saveDescription(fname, cntName, "File containing statistics results.", 00056 "", guid, clid, "NEW"); 00057 if ( status.isSuccess() ) { 00058 log << MSG::INFO << "Opened NEW Database file:" 00059 << fname << " as " << oname << endmsg; 00060 } 00061 } 00062 else if ( update ) { 00063 status = saveDescription(fname, cntName, "File containing statistics results.", 00064 "", guid, clid, "UPDATE"); 00065 if ( status.isSuccess() ) { 00066 log << MSG::INFO << "Connect to existing Database file:" 00067 << fname << " as " << oname << " for UPDATE" << endmsg; 00068 } 00069 } 00070 else if ( read ) { 00071 if ( status.isSuccess() ) { 00072 log << MSG::INFO << "Connect to existing Database file:" 00073 << fname << " as " << oname << " for READ" << endmsg; 00074 } 00075 } 00076 else if ( recrea ) { 00077 status = saveDescription(fname, cntName, "File containing statistics results.", 00078 "", guid, clid, "RECREATE"); 00079 if ( status.isSuccess() ) { 00080 log << MSG::INFO << "Recreate Database file:" << fname << " as " << oname << endmsg; 00081 } 00082 } 00083 else { 00084 log << MSG::ERROR << "Don't know what to do:" << fname << endmsg; 00085 status = StatusCode::FAILURE; 00086 } 00087 // Now create object 00088 if ( status.isSuccess() ) { 00089 NTuple::File* pFile = new NTuple::File(objType(), fname, oname); 00090 pFile->setOpen(false); 00091 refpObj = pFile; 00092 } 00093 } 00094 return status; 00095 }