ATLAS Offline Software
Loading...
Searching...
No Matches
TIDDirectory Class Reference

#include <TIDDirectory.h>

Collaboration diagram for TIDDirectory:

Public Member Functions

 TIDDirectory (const std::string &n="")
virtual ~TIDDirectory ()
void push ()
void pop ()
void Write ()
void pwd () const
TDirectory * cwd ()
void disable ()
void restore ()
const std::string & name () const

Protected Member Functions

std::string chop (std::string &s1, const std::string &s2="/")

Protected Attributes

std::string mname
TDirectory * mPop
TDirectory * mDir

Detailed Description

Definition at line 25 of file TIDDirectory.h.

Constructor & Destructor Documentation

◆ TIDDirectory()

TIDDirectory::TIDDirectory ( const std::string & n = "")
inline

only create directory if it doesn't already exist

only create directory if it doesn't already exist

only create directory if it doesn't already exist

recursively create any level of actual directories

Definition at line 31 of file TIDDirectory.h.

31 :
32 mname(n), mPop(gDirectory), mDir(0) {
33
34 if ( n=="" ) {
36 return;
37 }
38
39
40
41 if ( n.find("/")==std::string::npos ) {
43 mDir = gDirectory->GetDirectory(n.c_str());
44 if ( mDir==0 ) mDir = gDirectory->mkdir(n.c_str());
45 return;
46 }
47
48 std::string _dir = n;
49
50 if ( _dir.find("/")!=std::string::npos ) {
51
52 std::string dir = chop( _dir, "/" );
53
54 if ( _dir == "" ) {
56 mDir = gDirectory->GetDirectory( dir.c_str());
57 if ( mDir==0 ) mDir = gDirectory->mkdir( dir.c_str() );
58 return;
59 }
60
62 mDir = gDirectory->GetDirectory( dir.c_str());
63 if ( mDir==0 ) mDir = gDirectory->mkdir( dir.c_str() );
64 push();
65
67 TIDDirectory d(_dir);
68 mDir = d.cwd();
69 pop();
70 }
71
72 // push();
73 }
std::string mname
TDirectory * mDir
TIDDirectory(const std::string &n="")
std::string chop(std::string &s1, const std::string &s2="/")
TDirectory * mPop

◆ ~TIDDirectory()

virtual TIDDirectory::~TIDDirectory ( )
inlinevirtual

Definition at line 76 of file TIDDirectory.h.

76{ }

Member Function Documentation

◆ chop()

std::string TIDDirectory::chop ( std::string & s1,
const std::string & s2 = "/" )
inlineprotected

Definition at line 93 of file TIDDirectory.h.

93 {
94 std::string s3 = "";
95 std::string::size_type pos = s1.find(s2);
96 if ( pos != std::string::npos ) {
97 s3 = s1.substr(0, pos+s2.size());
98 s1.erase(0, pos+s2.size());
99 }
100 return s3;
101 }

◆ cwd()

TDirectory * TIDDirectory::cwd ( )
inline

Definition at line 84 of file TIDDirectory.h.

84{ return mDir; }

◆ disable()

void TIDDirectory::disable ( )
inline

Definition at line 86 of file TIDDirectory.h.

86{ }

◆ name()

const std::string & TIDDirectory::name ( ) const
inline

Definition at line 89 of file TIDDirectory.h.

89{ return mname; }

◆ pop()

void TIDDirectory::pop ( )
inline

Definition at line 79 of file TIDDirectory.h.

79{ if (mPop) mPop->cd(); }

◆ push()

void TIDDirectory::push ( )
inline

Definition at line 78 of file TIDDirectory.h.

78{ mPop = gDirectory; if (mDir) mDir->cd(); }

◆ pwd()

void TIDDirectory::pwd ( ) const
inline

Definition at line 83 of file TIDDirectory.h.

83{ mDir->pwd(); }

◆ restore()

void TIDDirectory::restore ( )
inline

Definition at line 87 of file TIDDirectory.h.

87{ }

◆ Write()

void TIDDirectory::Write ( )
inline

Definition at line 81 of file TIDDirectory.h.

81{ push(); mDir->Write(); pop(); }

Member Data Documentation

◆ mDir

TDirectory* TIDDirectory::mDir
protected

Definition at line 111 of file TIDDirectory.h.

◆ mname

std::string TIDDirectory::mname
protected

Definition at line 108 of file TIDDirectory.h.

◆ mPop

TDirectory* TIDDirectory::mPop
protected

Definition at line 110 of file TIDDirectory.h.


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