Gaudi Framework, version v23r6

Home   Generated: Wed Jan 30 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Gaudi::RootStatCnv Class Reference

Description: Base class converter for N-tuples and related classes. More...

#include <Root/RootStatCnv.h>

Inheritance diagram for Gaudi::RootStatCnv:
Inheritance graph
[legend]
Collaboration diagram for Gaudi::RootStatCnv:
Collaboration graph
[legend]

Public Member Functions

 RootStatCnv (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
 Initializing Constructor.
 
virtual ~RootStatCnv ()
 Standard Destructor.
 
- Public Member Functions inherited from Gaudi::RootConverter
 RootConverter (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
 Initializing Constructor.
 
virtual ~RootConverter ()
 Standard Destructor.
 
virtual long repSvcType () const
 Retrieve the class type of the data store the converter uses.
 
virtual StatusCode createObj (IOpaqueAddress *pAddr, DataObject *&refpObj)
 Converter overrides: Create transient object from persistent data.
 
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddr, DataObject *pObj)
 Resolve the references of the created 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)
 Resolve the references of the created transient object.
 
- Public Member Functions inherited from 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 updateRep (IOpaqueAddress *pAddress, DataObject *pObject)
 Update the converted representation of a transient 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")
 

Protected Member Functions

MsgStreamlog () const
 Helper to use mesage logger.
 
virtual StatusCode initialize ()
 Initialize converter object.
 
virtual StatusCode finalize ()
 Finalize converter object.
 
virtual const std::string containerName (IRegistry *pDir) const
 Retrieve the name of the container a given object is placed into.
 
virtual const std::string fileName (IRegistry *pReg) const
 Retrieve the name of the file a given object is placed into.
 
virtual const std::string topLevel (IRegistry *pReg) const
 Retrieve the full path of the file a given object is placed into.
 
StatusCode makeError (const std::string &msg, bool throw_exception=false) const
 Helper method to issue error messages.
 
StatusCode saveDescription (const std::string &path, const std::string &ident, const std::string &desc, const std::string &opt, const CLID &clid)
 Save statistics object description.
 

Protected Attributes

IDataManagerSvcm_dataMgr
 Reference to data manager service to manipulate the TES.
 
MsgStreamm_log
 Reference to logger object.
 
- Protected Attributes inherited from Gaudi::RootConverter
RootCnvSvcm_dbMgr
 Conversion service needed for proper operation to forward requests.
 

Additional Inherited Members

- Public Types inherited from implements1< IConverter >
typedef implements1 base_class
 Typedef to this class.
 
typedef extend_interfaces1
< IConverter
extend_interfaces_base
 Typedef to the base of this class.
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces.
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface.
 

Detailed Description

Description: Base class converter for N-tuples and related classes.

Author
M.Frank
Version
1.0

Definition at line 31 of file RootStatCnv.h.

Constructor & Destructor Documentation

RootStatCnv::RootStatCnv ( long  typ,
const CLID clid,
ISvcLocator svc,
RootCnvSvc mgr 
)

Initializing Constructor.

Parameters
typ[IN] Concrete storage type of the converter
clid[IN] Class identifier of the object
svc[IN] Pointer to service locator object
Returns
Reference to RootBaseCnv object

Definition at line 25 of file RootStatCnv.cpp.

: RootConverter(typ, clid, svc, mgr), m_dataMgr(0), m_log(0)
{
}
virtual Gaudi::RootStatCnv::~RootStatCnv ( )
inlinevirtual

Standard Destructor.

Definition at line 106 of file RootStatCnv.h.

{ }

Member Function Documentation

const string RootStatCnv::containerName ( IRegistry pDir) const
protectedvirtual

Retrieve the name of the container a given object is placed into.

Parameters
pReg[IN] Pointer to registry entry.
Returns
Name of the container the object should be put to.

Reimplemented in Gaudi::RootDatabaseCnv.

Definition at line 58 of file RootStatCnv.cpp.

{
const string& path = pReg->identifier();
long loc = path.find('/',1);
string local = "<local>";
//local = "";
if ( loc > 0 ) {
loc = path.find('/',++loc);
if ( loc > 0 ) {
local += path.substr(loc,path.length()-loc);
}
}
//for(size_t i=0; i<local.length();++i)
// if ( !isalnum(local[i])) local[i] = '_';
return local;
}
const string RootStatCnv::fileName ( IRegistry pReg) const
protectedvirtual

Retrieve the name of the file a given object is placed into.

Parameters
pReg[IN] Pointer to registry entry.
Returns
Name of the file the object should be put to.

Definition at line 75 of file RootStatCnv.cpp.

{
string path = topLevel(pReg);
DataObject* pObj = 0;
dataProvider()->retrieveObject(path, pObj);
if ( pObj ) {
NTuple::File* fptr = dynamic_cast<NTuple::File*>(pObj);
if ( fptr ) {
return fptr->name();
}
}
return "";
}
StatusCode RootStatCnv::finalize ( )
protectedvirtual

Finalize converter object.

Reimplemented from Converter.

Definition at line 45 of file RootStatCnv.cpp.

{
if ( m_log ) {
delete m_log;
m_log = 0;
}
if ( m_dataMgr ) {
m_dataMgr = 0;
}
return RootConverter::finalize();
}
StatusCode RootStatCnv::initialize ( )
protectedvirtual

Initialize converter object.

Reimplemented from Converter.

Definition at line 31 of file RootStatCnv.cpp.

{
if ( sc.isSuccess() ) {
sc = dataProvider()->queryInterface(IDataManagerSvc::interfaceID(),(void**)&m_dataMgr);
if ( !sc.isSuccess() ) {
return makeError("Failed to access IDataManagerSvc interface.");
}
}
if ( m_log ) delete m_log;
m_log = new MsgStream(msgSvc(),System::typeinfoName(typeid(*this)));
return sc;
}
MsgStream& Gaudi::RootStatCnv::log ( ) const
inlineprotected

Helper to use mesage logger.

Definition at line 39 of file RootStatCnv.h.

{ return *m_log; }
StatusCode RootStatCnv::makeError ( const std::string msg,
bool  throw_exception = false 
) const
protected

Helper method to issue error messages.

Parameters
msg[IN] Text of the error message
throw_exc[IN]If true throw an exception of type std::runtime_error
Returns
Status code indicating success or failure.

Definition at line 105 of file RootStatCnv.cpp.

{
if ( m_log ) {
log() << MSG::ERROR << msg << endmsg;
}
else {
MsgStream l(msgSvc(),"RootConverter");
l << MSG::ERROR << msg << endmsg;
}
if ( throw_exc ) {
}
}
StatusCode RootStatCnv::saveDescription ( const std::string path,
const std::string ident,
const std::string desc,
const std::string opt,
const CLID clid 
)
protected

Save statistics object description.

Parameters
path[IN] Path of file to save the description on.
ident[IN] Identifier of description to be saved.
desc[IN] Description
opt[IN] Optional description
guid[IN] Object giud of described object
openMode[IN] Mode of opening the file to save description
Returns
Status code indicating success or failure.

Definition at line 120 of file RootStatCnv.cpp.

{
StatusCode status = m_dbMgr->connectDatabase(path, IDataConnection::UPDATE, &con);
if ( status.isSuccess() ) {
TClass* cl = gROOT->GetClass("Gaudi::RootNTupleDescriptor",kTRUE);
if ( cl ) {
TBranch* b = con->getBranch("##Descriptors","GaudiStatisticsDescription",cl,ptr,512,0);
if ( b ) {
dsc->description = desc;
dsc->optional = opt;
dsc->container = ident;
dsc->clid = clid;
b->SetAddress(&ptr);
int nb = b->Fill();
if ( nb > 1 ) {
log() << MSG::DEBUG << "Save description for " << ident << endmsg;
}
}
return makeError("Failed to access ROOT branch GaudiStatisticsDescription");
}
return makeError("Failed to access TClass RootNTupleDescriptor");
}
return makeError("Failed to access Tuple file:"+path);
}
const string RootStatCnv::topLevel ( IRegistry pReg) const
protectedvirtual

Retrieve the full path of the file a given object is placed into.

Parameters
pReg[IN] Pointer to registry entry.
Returns
Name of the file the object should be put to.

Definition at line 89 of file RootStatCnv.cpp.

{
if ( pReg ) {
string path = pReg->identifier();
size_t idx = path.find('/', 1);
if ( idx != string::npos ) {
idx = path.find('/', idx+1);
if ( idx != string::npos ) {
path = path.substr(0, idx);
}
return path;
}
}
return "";
}

Member Data Documentation

IDataManagerSvc* Gaudi::RootStatCnv::m_dataMgr
protected

Reference to data manager service to manipulate the TES.

Definition at line 34 of file RootStatCnv.h.

MsgStream* Gaudi::RootStatCnv::m_log
protected

Reference to logger object.

Definition at line 36 of file RootStatCnv.h.


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

Generated at Wed Jan 30 2013 17:13:50 for Gaudi Framework, version v23r6 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004