ROOT
6.12/07
Reference Guide
ROOT Home Page
Main Page
Tutorials
User's Classes
+
Namespaces
Namespace List
+
Namespace Members
+
All
<
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
<
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
u
w
x
+
Enumerations
a
e
f
g
m
p
t
w
y
+
Enumerator
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
w
+
All Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
y
+
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
w
y
+
Enumerator
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Properties
f
+
Related Functions
:
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Files
File List
+
File Members
+
All
1
2
3
4
5
6
7
8
9
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
+
Enumerations
c
e
f
i
l
m
p
r
u
x
+
Enumerator
a
c
d
e
f
g
h
i
k
l
n
o
p
r
s
v
w
+
Macros
1
2
3
4
5
6
7
8
9
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Release Notes
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
core
base
inc
TRedirectOutputGuard.h
Go to the documentation of this file.
1
// @(#)root/base:$Id$
2
// Author: G. Ganis 10/10/2005
3
4
/*************************************************************************
5
* Copyright (C) 1995-2005, 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 ROOT_TRedirectOutputGuard
13
#define ROOT_TRedirectOutputGuard
14
15
//////////////////////////////////////////////////////////////////////////
16
// //
17
// TRedirectOutputGuard //
18
// //
19
// This class provides output redirection to a file in a guaranteed //
20
// exception safe way. Use like this: //
21
// { //
22
// TRedirectOutputGuard guard(filelog, mode); //
23
// ... // do something //
24
// } //
25
// when guard goes out of scope output is automatically redirected to //
26
// the standard units in the TRedirectOutputGuard destructor. //
27
// The exception mechanism takes care of calling the dtors //
28
// of local objects so it is exception safe. //
29
// The 'mode' options follow the fopen write modes convention; default //
30
// is "a". //
31
// //
32
//////////////////////////////////////////////////////////////////////////
33
34
#include "
TSystem.h
"
35
36
class
TRedirectOutputGuard
{
37
38
public
:
39
TRedirectOutputGuard
(
const
char
*fout,
const
char
*mode =
"a"
)
40
{
gSystem
->
RedirectOutput
(fout, mode); }
41
virtual
~TRedirectOutputGuard
() {
gSystem
->
RedirectOutput
(0); }
42
43
ClassDef
(
TRedirectOutputGuard
,0)
// Exception safe output redirection
44
};
45
46
#endif
TRedirectOutputGuard::~TRedirectOutputGuard
virtual ~TRedirectOutputGuard()
Definition:
TRedirectOutputGuard.h:41
TRedirectOutputGuard
Definition:
TRedirectOutputGuard.h:36
ClassDef
#define ClassDef(name, id)
Definition:
Rtypes.h:320
TSystem.h
gSystem
R__EXTERN TSystem * gSystem
Definition:
TSystem.h:540
TSystem::RedirectOutput
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:1688
TRedirectOutputGuard::TRedirectOutputGuard
TRedirectOutputGuard(const char *fout, const char *mode="a")
Definition:
TRedirectOutputGuard.h:39