TDirectory::TContext keeps track and restore the current directory.
With this tool C++ exceptions will be guaranteed to properly restore the current directory pointer.
For example code like:
can be replaced with the simpler and exception safe:
Definition at line 89 of file TDirectory.h.
Public Member Functions | |
| TContext () | |
| TContext (TDirectory *newCurrent) | |
| TContext (TDirectory *previous, TDirectory *newCurrent) | |
| ~TContext () | |
| Destructor.   | |
Private Member Functions | |
| TContext (TContext &)=delete | |
| Pointer to the next TContext in the implied list of context pointing to fPrevious.   | |
| void | CdNull () | 
| Set the current directory to null.   | |
| TContext & | operator= (TContext &)=delete | 
| void | RegisterCurrentDirectory () | 
Private Attributes | |
| std::atomic< bool > | fActiveDestructor {false} | 
| Pointer to the previous current directory.   | |
| std::atomic< TDirectory * > | fDirectory {nullptr} | 
| std::atomic< bool > | fDirectoryWait {false} | 
| Set to true during the destructor execution.   | |
| TContext * | fNext {nullptr} | 
| Pointer to the next TContext in the implied list of context pointing to fPrevious.   | |
| TContext * | fPrevious {nullptr} | 
| Set to true if a TDirectory might still access this object.   | |
Friends | |
| class | TDirectory | 
#include <TDirectory.h>
      
  | 
  privatedelete | 
Pointer to the next TContext in the implied list of context pointing to fPrevious.
      
  | 
  inline | 
Definition at line 108 of file TDirectory.h.
      
  | 
  inline | 
Definition at line 120 of file TDirectory.h.
      
  | 
  inline | 
Definition at line 126 of file TDirectory.h.
| TDirectory::TContext::~TContext | ( | ) | 
Destructor.
Reset the current directory to its previous state.
Definition at line 141 of file TDirectory.cxx.
      
  | 
  private | 
Set the current directory to null.
This is called from the TContext destructor. Since the destructor is inline, we do not want to have it directly use a global variable.
Definition at line 131 of file TDirectory.cxx.
      
  | 
  private | 
Definition at line 1349 of file TDirectory.cxx.
      
  | 
  friend | 
Definition at line 101 of file TDirectory.h.
      
  | 
  private | 
Pointer to the previous current directory.
Definition at line 92 of file TDirectory.h.
      
  | 
  private | 
Definition at line 91 of file TDirectory.h.
      
  | 
  private | 
Set to true during the destructor execution.
Definition at line 93 of file TDirectory.h.
      
  | 
  private | 
Pointer to the next TContext in the implied list of context pointing to fPrevious.
Definition at line 95 of file TDirectory.h.
      
  | 
  private | 
Set to true if a TDirectory might still access this object.
Definition at line 94 of file TDirectory.h.