1 #define ROOTHISTCNV_RCONVERTER_CPP 13 #include "TDirectory.h" 34 TDirectory* gDir = gDirectory;
44 auto p = full.
find(
":", 0 );
45 if ( p != std::string::npos ) {
49 gDirectory->cd( fil.
c_str() );
52 while ( ( p = full.
find(
"/", i ) ) != std::string::npos ) {
53 s = full.
substr( i, p - i );
59 if ( full.
compare( 0, 1,
"/" ) == 0 ) gDirectory->cd(
"/" );
61 for (
const auto& litr : lpath ) {
63 if ( !gDirectory->GetKey( litr.c_str() ) ) {
64 gDirectory->mkdir( litr.c_str() );
66 gDirectory->cd( litr.c_str() );
79 long lf1 = loc.
find(
"/NTUPLES/" );
80 long lf2 = loc.
find(
"/stat/" );
83 ll = loc.
find(
"/", lf1 + 9 );
85 }
else if ( lf2 != -1 ) {
86 ll = loc.
find(
"/", lf2 + 6 );
90 log <<
MSG::ERROR <<
"diskDirectory(" << loc <<
")" 91 <<
" --> no leading /NTUPLES/ or /stat/" <<
endmsg;
122 if (
findTFile( loc, tf ).isSuccess() ) {
131 gDirectory->cd(
"/" );
132 while ( ( p = full.
find(
"/", i ) ) != -1 ) {
133 sdir = full.
substr( i, p - i );
134 if ( !gDirectory->GetKey( sdir.
c_str() ) ) {
135 log <<
MSG::ERROR <<
"cannot cd to " << full <<
" from " << gDirectory->GetPath() <<
endmsg;
138 gDirectory->cd( sdir.
c_str() );
142 gDirectory->cd( full.
substr( i ).c_str() );
156 return gDirectory->GetPath();
170 (
unsigned long)( pTObj ), pTObj );
197 unsigned long* ipar = (
unsigned long*)refpAddress->
ipar();
214 StatusCode status = dataMgr->objectParent( pReg, pParentReg );
218 TDirectory* pParentDir = (TDirectory*)pParAddr->
ipar()[0];
220 gDirectory->cd( pParentDir->GetPath() );
274 auto imap = s_fileMap.find(
id );
275 if ( imap != s_fileMap.end() ) {
277 log <<
MSG::ERROR <<
"cannot register TTree " <<
id <<
": already exists" <<
endmsg;
280 s_fileMap[id] =
const_cast<TFile*
>( tfile );
296 i1 =
id.
find(
"/", 0 );
298 log <<
MSG::ERROR <<
"Directory name does not start with \"/\": " <<
id <<
endmsg;
301 i2 =
id.find(
"/", i1 + 1 );
306 i3 =
id.find(
"/", i2 + 1 );
313 auto imap = s_fileMap.find( idm );
315 tfile = imap->second;
323 if (
id.
size() > 0 && isdigit(
id[0] ) ) {
327 forced = tmp.
value();
std::string getDirectory()
constexpr static const auto FAILURE
Definition of the MsgStream class used to transmit messages.
std::string diskDirectory(const std::string &loc)
void setDirectory(const std::string &loc)
Implementation of property with value of concrete type.
const CLID & objType() const override
Retrieve the class type of objects the converter produces.
StatusCode createRep(DataObject *pObj, IOpaqueAddress *&refpAddr) override
Convert the transient object to the requested representation.
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
StatusCode regTFile(const std::string, const TFile *)
virtual const name_type & name() const =0
Name of the directory (or key)
SmartIF< IConversionSvc > & conversionSvc() const override
Get conversion service the converter is connected to.
StatusCode findTFile(const std::string, TFile *&)
StatusCode createDirectory(const std::string &loc)
IRegistry * registry() const
Get pointer to Registry.
TDirectory * changeDirectory(DataObject *pObject)
Switch to object directory (=Parent directory)
constexpr auto size(const C &c) noexcept(noexcept(c.size())) -> decltype(c.size())
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
long repSvcType() const override
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
virtual TObject * createPersistent(DataObject *pObj)
Create the persistent representation of an object.
This class is used for returning status codes from appropriate routines.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
unsigned int CLID
Class ID definition.
constexpr static const auto SUCCESS
SmartIF< IDataProviderSvc > & dataProvider() const override
Get Data provider service.
std::string directory(const std::string &loc)
StatusCode error(const std::string &msg)
std::string convertId(const std::string &) const
virtual StatusCode readObject(IOpaqueAddress *pAddr, DataObject *&refpObj)
Create the transient representation of an object.
bool assign(const Details::PropertyBase &source) override
get the value from another property
const ValueType & value() const
Backward compatibility (.
Opaque address interface definition.
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
A DataObject is the base class of any identifiable object on any data store.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StatusCode createAddress(DataObject *pObject, TDirectory *pDir, TObject *pTObject, IOpaqueAddress *&refpAddr)
Create address of the transient object according to the requested representation. ...
GAUDI_API Gaudi::Details::PropertyBase * getProperty(const IProperty *p, const std::string &name)
simple function which gets the property with given name from the component
void setDiskDirectory(const std::string &loc)