|
Gaudi Framework, version v23r1 |
| Home | Generated: Wed Feb 29 2012 |
Description: NTuple directory converter class definition Definition of the converter to manage the directories in an database representing N-Tuples. More...
#include <src/RootDirectoryCnv.h>


Public Member Functions | |
| RootDirectoryCnv (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr) | |
| Initializing Constructor. | |
| virtual | ~RootDirectoryCnv () |
| Standard Destructor. | |
| virtual StatusCode | createObj (IOpaqueAddress *pAddr, DataObject *&refpObj) |
| Converter overrides: Create transient object from persistent data. | |
| virtual StatusCode | fillObjRefs (IOpaqueAddress *pAddr, DataObject *pObj) |
| Converter overrides: Resolve the references of the transient object. | |
| virtual StatusCode | updateObj (IOpaqueAddress *pAddr, DataObject *pObj) |
| Converter overrides: Update transient object from persistent data. | |
| virtual StatusCode | updateObjRefs (IOpaqueAddress *pAddr, DataObject *pObj) |
| Converter overrides: Update the references of an updated transient object. | |
| virtual StatusCode | createRep (DataObject *pObj, IOpaqueAddress *&refpAddr) |
| Converter overrides: Convert the transient object to the requested representation. | |
| virtual StatusCode | fillRepRefs (IOpaqueAddress *pAddr, DataObject *pObj) |
| Converter overrides: Fill references of persistent object representation. | |
| virtual StatusCode | updateRep (IOpaqueAddress *pAddr, DataObject *pObj) |
| Converter overrides: Update persistent object representation. | |
| virtual StatusCode | updateRepRefs (IOpaqueAddress *pAddr, DataObject *pObj) |
| Converter overrides: Update references of persistent object representation. | |
Description: NTuple directory converter class definition Definition of the converter to manage the directories in an database representing N-Tuples.
Definition at line 31 of file RootDirectoryCnv.h.
| RootDirectoryCnv::RootDirectoryCnv | ( | long | typ, |
| const CLID & | clid, | ||
| ISvcLocator * | svc, | ||
| RootCnvSvc * | mgr | ||
| ) |
Initializing Constructor.
| typ | [IN] Concrete storage type of the converter |
| clid | [IN] Class identifier of the object |
| svc | [IN] Pointer to service locator object |
Definition at line 33 of file RootDirectoryCnv.cpp.
: RootStatCnv(typ, clid, svc, mgr) { }
| virtual Gaudi::RootDirectoryCnv::~RootDirectoryCnv | ( | ) | [inline, virtual] |
| StatusCode RootDirectoryCnv::createObj | ( | IOpaqueAddress * | pAddr, |
| DataObject *& | refpObj | ||
| ) | [virtual] |
Converter overrides: Create transient object from persistent data.
| pAddr | [IN] Pointer to object address. |
| refpObj | [OUT] Location to pointer to store data object |
Reimplemented from Gaudi::RootConverter.
Reimplemented in Gaudi::RootDatabaseCnv.
Definition at line 42 of file RootDirectoryCnv.cpp.
{
refpObj = new NTuple::Directory();
return StatusCode::SUCCESS;
}
| StatusCode RootDirectoryCnv::createRep | ( | DataObject * | pObj, |
| IOpaqueAddress *& | refpAddr | ||
| ) | [virtual] |
Converter overrides: Convert the transient object to the requested representation.
| pObj | [IN] Pointer to data object |
| refpAddr | [OUT] Location to store pointer to object address. |
Reimplemented from Gaudi::RootConverter.
Definition at line 49 of file RootDirectoryCnv.cpp.
{
string dsc;
if ( objType() == CLID_StatisticsDirectory ) {
dsc = "Directory containing statistics results.";
}
else if ( objType() == CLID_StatisticsFile ) {
dsc = "File containing statistics results.";
}
else {
return StatusCode::FAILURE;
}
string ident = containerName(pObj->registry());
string path = fileName(pObj->registry());
return saveDescription(path, ident, dsc, ident, objType());
}
| StatusCode RootDirectoryCnv::fillObjRefs | ( | IOpaqueAddress * | pAddr, |
| DataObject * | pObj | ||
| ) | [virtual] |
Converter overrides: Resolve the references of the transient object.
| pAddr | [IN] Pointer to object address. |
| pObj | [IN] Pointer to data object |
Reimplemented from Gaudi::RootConverter.
Definition at line 66 of file RootDirectoryCnv.cpp.
{
return updateObjRefs(pAddr, pObj);
}
| StatusCode RootDirectoryCnv::fillRepRefs | ( | IOpaqueAddress * | pAddr, |
| DataObject * | pObj | ||
| ) | [virtual] |
Converter overrides: Fill references of persistent object representation.
| pObj | [IN] Pointer to data object |
| refpAddr | [OUT] Location to store pointer to object address. |
Reimplemented from Gaudi::RootConverter.
Definition at line 198 of file RootDirectoryCnv.cpp.
{
return StatusCode::SUCCESS;
}
| StatusCode RootDirectoryCnv::updateObj | ( | IOpaqueAddress * | pAddr, |
| DataObject * | pObj | ||
| ) | [virtual] |
Converter overrides: Update transient object from persistent data.
| pAddr | [IN] Pointer to object address. |
| pObj | [IN] Pointer to data object |
Reimplemented from Converter.
Definition at line 174 of file RootDirectoryCnv.cpp.
{
return StatusCode::SUCCESS;
}
| StatusCode RootDirectoryCnv::updateObjRefs | ( | IOpaqueAddress * | pAddr, |
| DataObject * | pObj | ||
| ) | [virtual] |
Converter overrides: Update the references of an updated transient object.
| pAddr | [IN] Pointer to object address. |
| pObj | [IN] Pointer to data object |
Reimplemented from Converter.
Definition at line 72 of file RootDirectoryCnv.cpp.
{
typedef vector<RootNTupleDescriptor*> REFS;
REFS refs;
StatusCode status = StatusCode(StatusCode::FAILURE,true);
if ( pAddr ) {
IRegistry* pReg = pAddr->registry();
if ( pReg ) {
typedef vector<IRegistry*> Leaves;
string ident = pReg->identifier();
string fname = fileName(pReg);
string cntName = containerName(pReg);
RootDataConnection* con = 0;
Leaves leaves;
status = m_dbMgr->connectDatabase(fname, IDataConnection::READ, &con);
if ( status.isSuccess() ) {
TBranch* b = con->getBranch("##Descriptors","GaudiStatisticsDescription");
if ( b ) {
for(Long64_t n=b->GetEntries(), i=0; i<n; ++i) {
RootNTupleDescriptor* ref=0;
b->SetAddress(&ref);
int nb = b->GetEntry(i);
if ( nb > 1 ) {
string s = ref->container.substr(0,cntName.length());
log() << MSG::VERBOSE << "Read description:" << ref->container
<< " " << ident << " " << cntName << endmsg;
if ( s == cntName ) {
if ( ref->container.length() >= cntName.length()+1 ) {
if ( ref->container.find('/',cntName.length()+1) == string::npos ) {
refs.push_back(ref);
continue;
}
}
}
}
delete ref;
}
}
log() << MSG::DEBUG << "Got " << refs.size() << " tuple connection(s)....." << endmsg;
status = m_dataMgr->objectLeaves(pObject, leaves);
if ( status.isSuccess() ) {
for(REFS::iterator i = refs.begin(); i != refs.end(); ++i) {
REFS::value_type& ref = *i;
if ( ref ) {
bool need_to_add = true;
for(Leaves::iterator j=leaves.begin(); j != leaves.end(); ++j ) {
string curr_leaf = containerName(*j);
if ( curr_leaf == ref->container ) {
need_to_add = false;
break;
}
}
if ( need_to_add ) {
IOpaqueAddress* pA= 0;
if ( ref->clid == CLID_StatisticsDirectory ||
ref->clid == CLID_StatisticsFile ||
ref->clid == CLID_RowWiseTuple ||
ref->clid == CLID_ColumnWiseTuple )
{
string spar[] = { fname, ref->container};
unsigned long ipar[] = { ~0x0UL, ~0x0UL };
status = m_dbMgr->createAddress(repSvcType(),
ref->clid,
spar,
ipar,
pA);
}
if ( status.isSuccess() ) {
string top = topLevel(pReg);
string leaf_name = top + ref->container.substr(7);
status = m_dataMgr->registerAddress(leaf_name, pA);
if ( status.isSuccess() ) {
log() << MSG::DEBUG << "Created address for " << leaf_name
<< " of type " << ref->clid << endmsg;
continue;
}
makeError("Failed to register leaves to directory:"+ident,false).ignore();
break;
}
makeError("Failed to create leave address to directory:"+ident,false).ignore();
break;
}
}
makeError("Failed to add leaves to directory:"+ident,false).ignore();
break;
}
}
}
else {
return makeError("Failed to access required tuple data description.",false);
}
}
}
for(REFS::iterator k = refs.begin(); k != refs.end(); ++k) {
if ( *k ) delete (*k);
}
return status;
}
| StatusCode RootDirectoryCnv::updateRep | ( | IOpaqueAddress * | pAddr, |
| DataObject * | pObj | ||
| ) | [virtual] |
Converter overrides: Update persistent object representation.
| pObj | [IN] Pointer to data object |
| refpAddr | [OUT] Location to store pointer to object address. |
Reimplemented from Converter.
Definition at line 182 of file RootDirectoryCnv.cpp.
{
return StatusCode::SUCCESS;
}
| StatusCode RootDirectoryCnv::updateRepRefs | ( | IOpaqueAddress * | pAddr, |
| DataObject * | pObj | ||
| ) | [virtual] |
Converter overrides: Update references of persistent object representation.
| pObj | [IN] Pointer to data object |
| refpAddr | [OUT] Location to store pointer to object address. |
Reimplemented from Converter.
Definition at line 190 of file RootDirectoryCnv.cpp.
{
return StatusCode::SUCCESS;
}