A class restoring the previous TDirectory
on destruction.
More...
#include <ROOTutils.h>
Public Member Functions | |
TDirectoryChanger () | |
TDirectoryChanger (TDirectory *dir) | |
TDirectoryChanger (std::string const &dir, std::string const &title="") | |
~TDirectoryChanger () | |
void | save () |
Stores the current directory as the one to be saved. More... | |
void | restore () const |
void | forget () |
Do not restore the old directory on destruction. More... | |
void | cd () const |
Make the stored new directory as current again. More... | |
void | cd (TDirectory *dir) |
Make the specified directory as current. More... | |
void | cd (std::string const &name, std::string const &title="") |
Make the specified directory as current, possibly creating it. More... | |
TDirectory * | saved () const |
Returns a pointer to the directory that will be restored on destruction. More... | |
bool | hasSaved () const |
Returns whether there is a directory to be restored on destruction. More... | |
Static Public Member Functions | |
static TDirectory * | currentDir () |
Private Attributes | |
TDirectory * | pSaved = nullptr |
TDirectory * | pNew = nullptr |
A class restoring the previous TDirectory
on destruction.
When an instance of this object is created, the existing current directory is saved, and it is then restored on destruction.
Additional methods allow finer control on the restoration feature.
Example:
Definition at line 54 of file ROOTutils.h.
|
inline |
Definition at line 61 of file ROOTutils.h.
|
inline |
Definition at line 62 of file ROOTutils.h.
|
inline |
Definition at line 63 of file ROOTutils.h.
|
inline |
Definition at line 66 of file ROOTutils.h.
|
inline |
|
inline |
Make the specified directory as current.
Definition at line 82 of file ROOTutils.h.
|
inline |
Make the specified directory as current, possibly creating it.
Definition at line 85 of file ROOTutils.h.
|
inlinestatic |
Definition at line 99 of file ROOTutils.h.
|
inline |
|
inline |
Returns whether there is a directory to be restored on destruction.
Definition at line 97 of file ROOTutils.h.
|
inline |
Immediately restores the old directory. It will still restored on destruction too.
Definition at line 73 of file ROOTutils.h.
|
inline |
|
inline |
Returns a pointer to the directory that will be restored on destruction.
Definition at line 94 of file ROOTutils.h.
|
private |
Definition at line 57 of file ROOTutils.h.
|
private |
Definition at line 56 of file ROOTutils.h.