Logo ROOT   6.10/09
Reference Guide
redirguard.h
Go to the documentation of this file.
1 // @(#)root/proof:$Id$
2 // Author: G. Ganis, Mar 2010
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef PQ2_redirguard
13 #define PQ2_redirguard
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // redirguard //
18 // //
19 // Auxilliary class used in PQ2 functions to redirect the logs //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #include "TSystem.h"
24 
25 class redirguard {
26 private:
29 public:
30  redirguard(const char *fn, const char *mode = "a", Int_t doit = 0)
31  { fDoIt = (doit == 0) ? kTRUE : kFALSE;
32  if (fDoIt) gSystem->RedirectOutput(fn, mode, &fRH); }
33  ~redirguard() { if (fDoIt) gSystem->RedirectOutput(0, 0, &fRH); }
34 };
35 #endif
redirguard(const char *fn, const char *mode="a", Int_t doit=0)
Definition: redirguard.h:30
Bool_t fDoIt
Definition: redirguard.h:28
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
R__EXTERN TSystem * gSystem
Definition: TSystem.h:539
const Bool_t kFALSE
Definition: RtypesCore.h:92
virtual Int_t RedirectOutput(const char *name, const char *mode="a", RedirectHandle_t *h=0)
Redirect standard output (stdout, stderr) to the specified file.
Definition: TSystem.cxx:1684
RedirectHandle_t fRH
Definition: redirguard.h:27
const Bool_t kTRUE
Definition: RtypesCore.h:91