SaveCurrentTDirectory.h
Go to the documentation of this file.
1 #ifndef _utl_SaveCurrentTDirectory_h_
2 #define _utl_SaveCurrentTDirectory_h_
3 
4 #include <TDirectory.h>
5 
6 
7 namespace utl {
8 
9  /*
10  \class SaveCurrentTDirectory
11 
12  Use it to save current TDirectory setting which will be
13  restored upon destruction, ie when the object goes out
14  of scope.
15 
16  \code
17  if (saveRootFile) {
18  SaveCurrentTDirectory save;
19  TFile* const f = TFile::Open(...);
20  canvas.Write();
21  }
22  \endcode
23 
24  \author Darko Veberic
25  */
26 
28  public:
29  SaveCurrentTDirectory() : fDirectory(gDirectory) { }
30 
32 
33  private:
34  TDirectory* const fDirectory;
35  };
36 
37 }
38 
39 
40 #endif

, generated on Tue Sep 26 2023.