ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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 ()
 
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=="" ) {
35  mDir = gDirectory;
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  }

◆ ~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()

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:
ReadCellNoiseFromCoolCompare.s1
s1
Definition: ReadCellNoiseFromCoolCompare.py:378
TIDDirectory::pop
void pop()
Definition: TIDDirectory.h:79
hist_file_dump.d
d
Definition: hist_file_dump.py:137
TIDDirectory::chop
std::string chop(std::string &s1, const std::string s2="/")
Definition: TIDDirectory.h:93
TIDDirectory
Definition: TIDDirectory.h:25
ParseInputs.gDirectory
gDirectory
Definition: Final2012/ParseInputs.py:133
beamspotman.n
n
Definition: beamspotman.py:731
TIDDirectory::mPop
TDirectory * mPop
Definition: TIDDirectory.h:110
beamspotman.dir
string dir
Definition: beamspotman.py:623
TIDDirectory::mDir
TDirectory * mDir
Definition: TIDDirectory.h:111
ReadCellNoiseFromCoolCompare.s3
s3
Definition: ReadCellNoiseFromCoolCompare.py:380
TIDDirectory::push
void push()
Definition: TIDDirectory.h:78
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
ReadCellNoiseFromCoolCompare.s2
s2
Definition: ReadCellNoiseFromCoolCompare.py:379
TIDDirectory::mname
std::string mname
Definition: TIDDirectory.h:108