Gaudi Framework, version v25r1

Home   Generated: Mon Mar 24 2014
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | List of all members
RootHistCnv::RDirectoryCnv Class Reference

Create persistent and transient representations of data store directories. More...

#include <RDirectoryCnv.h>

Inheritance diagram for RootHistCnv::RDirectoryCnv:
Inheritance graph
[legend]
Collaboration diagram for RootHistCnv::RDirectoryCnv:
Collaboration graph
[legend]

Public Member Functions

virtual StatusCode createObj (IOpaqueAddress *pAddr, DataObject *&refpObj)
 Create the transient representation of an object.
 
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddr, DataObject *refpObj)
 Update the transient object from the other representation.
 
virtual StatusCode createRep (DataObject *pObj, IOpaqueAddress *&refpAddr)
 Convert the transient object to the requested representation.
 
virtual StatusCode updateRep (IOpaqueAddress *pAddr, DataObject *pObject)
 Convert the transient object to the requested representation.
 
 RDirectoryCnv (ISvcLocator *svc)
 Standard constructor.
 
 RDirectoryCnv (ISvcLocator *svc, const CLID &clid)
 Standard constructor.
 
virtual ~RDirectoryCnv ()
 Standard destructor.
 
- Public Member Functions inherited from RootHistCnv::RConverter
long repSvcType () const
 Retrieve the class type of the data store the converter uses.
 
StatusCode error (const std::string &msg)
 
StatusCode regTFile (const std::string, const TFile *)
 
StatusCode findTFile (const std::string, TFile *&)
 
std::string diskDirectory (const std::string &loc)
 
std::string directory (const std::string &loc)
 
void setDirectory (const std::string &loc)
 
void setDiskDirectory (const std::string &loc)
 
StatusCode createDirectory (const std::string &loc)
 
StatusCode createDiskDirectory (const std::string &loc)
 
std::string getDirectory ()
 
std::string convertId (const std::string &) const
 
- Public Member Functions inherited from Converter
virtual StatusCode initialize ()
 Initialize the converter.
 
virtual StatusCode finalize ()
 Initialize the converter.
 
virtual StatusCode setDataProvider (IDataProviderSvc *svc)
 Set Data provider service.
 
virtual SmartIF
< IDataProviderSvc > & 
dataProvider () const
 Get Data provider service.
 
virtual StatusCode setConversionSvc (IConversionSvc *svc)
 Set conversion service the converter is connected to.
 
virtual SmartIF< IConversionSvc > & conversionSvc () const
 Get conversion service the converter is connected to.
 
virtual StatusCode setAddressCreator (IAddressCreator *creator)
 Set address creator facility.
 
virtual SmartIF
< IAddressCreator > & 
addressCreator () const
 Retrieve address creator facility.
 
virtual const CLIDobjType () const
 Retrieve the class type of objects the converter produces.
 
virtual long i_repSvcType () const
 Retrieve the class type of the data store the converter uses.
 
virtual StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *refpObject)
 Update the transient object from the other representation.
 
virtual StatusCode updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Update the references of an updated transient object.
 
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
 
virtual StatusCode updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Update the references of an already converted object.
 
 Converter (long storage_type, const CLID &class_type, ISvcLocator *svc=0)
 Standard Constructor.
 
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.
 
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.
 
SmartIF< IServiceservice (const std::string &name, const bool createIf=true) const
 Return a pointer to the service identified by name (or "type/name")
 

Static Public Member Functions

static const CLIDclassID ()
 Inquire class type.
 
- Static Public Member Functions inherited from RootHistCnv::RConverter
static long storageType ()
 Inquire storage type.
 

Additional Inherited Members

- Public Types inherited from Converter
typedef
Gaudi::PluginService::Factory1
< IConverter *, ISvcLocator * > 
Factory
 
- Protected Member Functions inherited from RootHistCnv::RConverter
 RConverter (const CLID &clid, ISvcLocator *svc)
 Standard constructor.
 
virtual ~RConverter ()
 Standard destructor.
 
virtual StatusCode readObject (IOpaqueAddress *pAddr, DataObject *&refpObj)
 Create the transient representation of an object.
 
virtual TObject * createPersistent (DataObject *pObj)
 Create the persistent representation of an object.
 
StatusCode createAddress (DataObject *pObject, TDirectory *pDir, TObject *pTObject, IOpaqueAddress *&refpAddr)
 Create address of the transient object according to the requested representation.
 
StatusCode createAddress (const std::string &rzdir, const CLID &clid, long id, TObject *pTobj, IOpaqueAddress *&refpAddress)
 
StatusCode createAddress (const std::string &rzdir, const CLID &clid, const std::string &title, TObject *pTobj, IOpaqueAddress *&refpAddress)
 
TDirectory * changeDirectory (DataObject *pObject)
 Switch to object directory (=Parent directory)
 

Detailed Description

Create persistent and transient representations of data store directories.

Author
Charles Leggett

Definition at line 17 of file RDirectoryCnv.h.

Constructor & Destructor Documentation

RootHistCnv::RDirectoryCnv::RDirectoryCnv ( ISvcLocator svc)
inline

Standard constructor.

Definition at line 30 of file RDirectoryCnv.h.

RootHistCnv::RDirectoryCnv::RDirectoryCnv ( ISvcLocator svc,
const CLID clid 
)
inline

Standard constructor.

Definition at line 32 of file RDirectoryCnv.h.

: RConverter(clid, svc){}
virtual RootHistCnv::RDirectoryCnv::~RDirectoryCnv ( )
inlinevirtual

Standard destructor.

Definition at line 34 of file RDirectoryCnv.h.

{}

Member Function Documentation

static const CLID& RootHistCnv::RDirectoryCnv::classID ( )
inlinestatic

Inquire class type.

Definition at line 28 of file RDirectoryCnv.h.

StatusCode RootHistCnv::RDirectoryCnv::createObj ( IOpaqueAddress pAddr,
DataObject *&  refpObj 
)
virtual

Create the transient representation of an object.

Reimplemented from Converter.

Reimplemented in RootHistCnv::RFileCnv.

Definition at line 28 of file RDirectoryCnv.cpp.

{
refpObject = new NTuple::Directory();
}
StatusCode RootHistCnv::RDirectoryCnv::createRep ( DataObject pObj,
IOpaqueAddress *&  refpAddr 
)
virtual

Convert the transient object to the requested representation.

Reimplemented from RootHistCnv::RConverter.

Reimplemented in RootHistCnv::RFileCnv.

Definition at line 38 of file RDirectoryCnv.cpp.

{
const std::string& loc = pObject->registry()->identifier();
if ( createDirectory(loc).isSuccess() ) {
// return createAddress(pObject, pObject->registry()->name(), refpAddress);
return createAddress(pObject, gDirectory, 0, refpAddress);
}
refpAddress = 0;
}
StatusCode RootHistCnv::RDirectoryCnv::fillObjRefs ( IOpaqueAddress pAddr,
DataObject refpObj 
)
virtual

Update the transient object from the other representation.

Reimplemented from Converter.

Definition at line 70 of file RDirectoryCnv.cpp.

{
MsgStream log(msgSvc(), "RDirectoryCnv");
IRegistry* pReg = pObj->registry();
std::string full = pReg->identifier();
const std::string& fname = pAddr->par()[0];
TFile *tf;
findTFile(full,tf).ignore();
// cd to TFile:
setDirectory(full);
TIter nextkey(gDirectory->GetListOfKeys());
while (TKey *key = (TKey*)nextkey()) {
IOpaqueAddress* pA = 0;
TObject *obj = key->ReadObj();
std::string title = obj->GetTitle();
std::string sid = obj->GetName();
std::string f2 = full + "/" + sid;
int idh = ::strtol(sid.c_str(),NULL,10);
// introduced by Grigori Rybkine
std::string clname = key->GetClassName();
std::string clnm = clname.substr(0,3);
TClass* isa = obj->IsA();
if (isa->InheritsFrom("TTree")) {
createAddress(full, CLID_ColumnWiseTuple, idh, obj, pA).ignore();
TTree* tree = (TTree*) obj;
tree->Print();
log << MSG::DEBUG << "Reg CWNT \"" << obj->GetTitle()
<< "\" as " << f2 << endmsg;
title = "/" + sid;
} else if (isa->InheritsFrom("TDirectory")) {
createAddress(full,CLID_NTupleDirectory, title, obj, pA).ignore();
} else if ( isa == TProfile::Class() ) {
createAddress(full,CLID_ProfileH,idh,obj,pA).ignore();
title = sid;
} else if ( isa == TProfile2D::Class() ) {
createAddress(full,CLID_ProfileH2,idh,obj,pA).ignore();
title = sid;
} else if ( isa == TH1C::Class() ) {
createAddress(full,CLID_H1D,idh,obj,pA).ignore();
title = sid;
} else if ( isa == TH1S::Class() ) {
createAddress(full,CLID_H1D,idh,obj,pA).ignore();
title = sid;
} else if ( isa == TH1I::Class() ) {
createAddress(full,CLID_H1D,idh,obj,pA).ignore();
title = sid;
} else if ( isa == TH1F::Class() ) {
createAddress(full,CLID_H1D,idh,obj,pA).ignore();
title = sid;
} else if ( isa == TH1D::Class() ) {
createAddress(full,CLID_H1D,idh,obj,pA).ignore();
title = sid;
} else if ( isa == TH2C::Class() ) {
createAddress(full,CLID_H2D,idh,obj,pA).ignore();
title = sid;
} else if ( isa == TH2S::Class() ) {
createAddress(full,CLID_H2D,idh,obj,pA).ignore();
title = sid;
} else if ( isa == TH2I::Class() ) {
createAddress(full,CLID_H2D,idh,obj,pA).ignore();
title = sid;
} else if ( isa == TH2F::Class() ) {
createAddress(full,CLID_H2D,idh,obj,pA).ignore();
title = sid;
} else if ( isa == TH2D::Class() ) {
createAddress(full,CLID_H2D,idh,obj,pA).ignore();
title = sid;
} else if ( isa == TH3C::Class() ) {
createAddress(full,CLID_H3D,idh,obj,pA).ignore();
title = sid;
} else if ( isa == TH3S::Class() ) {
createAddress(full,CLID_H3D,idh,obj,pA).ignore();
title = sid;
} else if ( isa == TH3I::Class() ) {
createAddress(full,CLID_H3D,idh,obj,pA).ignore();
title = sid;
} else if ( isa == TH3F::Class() ) {
createAddress(full,CLID_H3D,idh,obj,pA).ignore();
title = sid;
} else if ( isa == TH3D::Class() ) {
createAddress(full,CLID_H3D,idh,obj,pA).ignore();
title = sid;
} else {
log << MSG::ERROR << "Encountered an unknown object with key: "
<< obj->GetName() << " in ROOT file " << fname << endmsg;
}
if ( 0 != pA ) {
StatusCode sc = dataManager()->registerAddress(pReg, title, pA);
if ( !sc.isSuccess() ) {
log << MSG::ERROR << "Failed to register address for " << full << endmsg;
return sc;
}
log << MSG::VERBOSE << "Created address for " << clnm
<< "'" << title << "' in " << full << endmsg;
}
}
}
StatusCode RootHistCnv::RDirectoryCnv::updateRep ( IOpaqueAddress pAddr,
DataObject pObject 
)
virtual

Convert the transient object to the requested representation.

Reimplemented from Converter.

Reimplemented in RootHistCnv::RFileCnv.

Definition at line 55 of file RDirectoryCnv.cpp.

{
const std::string& loc = pObject->registry()->identifier();
if ( createDirectory(loc).isSuccess() ) {
}
}

The documentation for this class was generated from the following files:

Generated at Mon Mar 24 2014 18:27:54 for Gaudi Framework, version v25r1 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004