|
||||
Warning, file /include/root/TRedirectOutputGuard.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // @(#)root/base:$Id$ 0002 // Author: G. Ganis 10/10/2005 0003 0004 /************************************************************************* 0005 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. * 0006 * All rights reserved. * 0007 * * 0008 * For the licensing terms see $ROOTSYS/LICENSE. * 0009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 0010 *************************************************************************/ 0011 0012 #ifndef ROOT_TRedirectOutputGuard 0013 #define ROOT_TRedirectOutputGuard 0014 0015 ////////////////////////////////////////////////////////////////////////// 0016 // // 0017 // TRedirectOutputGuard // 0018 // // 0019 // This class provides output redirection to a file in a guaranteed // 0020 // exception safe way. Use like this: // 0021 // { // 0022 // TRedirectOutputGuard guard(filelog, mode); // 0023 // ... // do something // 0024 // } // 0025 // when guard goes out of scope output is automatically redirected to // 0026 // the standard units in the TRedirectOutputGuard destructor. // 0027 // The exception mechanism takes care of calling the dtors // 0028 // of local objects so it is exception safe. // 0029 // The 'mode' options follow the fopen write modes convention; default // 0030 // is "a". // 0031 // // 0032 ////////////////////////////////////////////////////////////////////////// 0033 0034 #include "TSystem.h" 0035 0036 class TRedirectOutputGuard { 0037 0038 public: 0039 TRedirectOutputGuard(const char *fout, const char *mode = "a") 0040 { gSystem->RedirectOutput(fout, mode); } 0041 virtual ~TRedirectOutputGuard() { gSystem->RedirectOutput(nullptr); } 0042 0043 ClassDef(TRedirectOutputGuard,0) // Exception safe output redirection 0044 }; 0045 0046 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |