Geant4
10.03
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
G4ofstreamDestination.hh
Go to the documentation of this file.
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
//
27
// $Id: G4coutDestination.hh 66241 2014-05-16 00:00:42Z adotti $
28
//
29
//
30
// ---------------------------------------------------------------
31
// GEANT 4 class header file
32
//
33
// G4ofstreamDestination.hh
34
// Sends G4cout and G4cerr to a file.
35
//
36
// To send G4cout to a file instantiate an instance of
37
// G4CoutToFile
38
// To send G4cerr to a file use instead
39
// G4CerrToFile
40
//
41
// Example:
42
// #include "G4ofstreamDestination.hh"
43
// #include "G4ios.hh"
44
// int main(int,char**) {
45
// G4UImanager::GetUIpointer();
46
// G4iosInitialization();
47
// G4CoutToFile myout("MyOut_out.log"); // G4cout to file
48
// G4CerrToFile myout("MyOut_err.log"); // G4cerr to file
49
// ---------------------------------------------------------------
50
#ifndef G4OFSTREAMDESTINATION_HH
51
#define G4OFSTREAMDESTINATION_HH
52
53
#include "
G4coutDestination.hh
"
54
#include <fstream>
55
56
57
class
G4ofstreamDestinationBase
:
public
G4coutDestination
58
{
59
public
:
60
G4ofstreamDestinationBase
(
const
G4String
& defaultName ,
G4bool
append);
61
virtual
~G4ofstreamDestinationBase
();
62
63
virtual
G4int
ReceiveG4cout
(
const
G4String
& ) = 0;
64
virtual
G4int
ReceiveG4cerr
(
const
G4String
& ) = 0;
65
66
void
SetFileName
(
const
G4String
&
name
,
G4bool
append =
true
);
67
void
Close
();
68
void
Open
();
69
private
:
70
G4String
fileName
;
71
G4bool
appendFlag
;
72
protected
:
73
std::ofstream
g4file
;
74
};
75
76
class
G4CoutToFile
:
public
G4ofstreamDestinationBase
77
{
78
public
:
79
G4CoutToFile
(
const
G4String
& deafaultName =
"Geant4_cout.txt"
,
G4bool
append =
true
);
80
virtual
G4int
ReceiveG4cout
(
const
G4String
& msg );
81
virtual
G4int
ReceiveG4cerr
(
const
G4String
& ) {
return
0;}
82
};
83
84
class
G4CerrToFile
:
public
G4ofstreamDestinationBase
85
{
86
public
:
87
G4CerrToFile
(
const
G4String
& deafaultName =
"Geant4_cerr.txt"
,
G4bool
append =
true
);
88
virtual
G4int
ReceiveG4cout
(
const
G4String
& ) {
return
0; }
89
virtual
G4int
ReceiveG4cerr
(
const
G4String
& msg );
90
91
};
92
#endif //G4OFSTREAMDESTINATION_HH
G4ofstreamDestinationBase::fileName
G4String fileName
Definition:
G4ofstreamDestination.hh:70
G4CoutToFile::ReceiveG4cerr
virtual G4int ReceiveG4cerr(const G4String &)
Definition:
G4ofstreamDestination.hh:81
G4CerrToFile::ReceiveG4cerr
virtual G4int ReceiveG4cerr(const G4String &msg)
Definition:
G4ofstreamDestination.cc:101
G4ofstreamDestinationBase::g4file
std::ofstream g4file
Definition:
G4ofstreamDestination.hh:73
G4CerrToFile::G4CerrToFile
G4CerrToFile(const G4String &deafaultName="Geant4_cerr.txt", G4bool append=true)
Definition:
G4ofstreamDestination.cc:95
G4ofstreamDestinationBase::Close
void Close()
Definition:
G4ofstreamDestination.cc:72
G4coutDestination
Definition:
G4coutDestination.hh:41
G4CoutToFile
Definition:
G4ofstreamDestination.hh:76
G4InuclParticleNames::name
const char * name(G4int ptype)
Definition:
G4InuclParticleNames.hh:77
G4int
int G4int
Definition:
G4Types.hh:78
G4CerrToFile
Definition:
G4ofstreamDestination.hh:84
G4coutDestination.hh
G4ofstreamDestinationBase::G4ofstreamDestinationBase
G4ofstreamDestinationBase(const G4String &defaultName, G4bool append)
Definition:
G4ofstreamDestination.cc:42
G4ofstreamDestinationBase::appendFlag
G4bool appendFlag
Definition:
G4ofstreamDestination.hh:71
G4ofstreamDestinationBase::~G4ofstreamDestinationBase
virtual ~G4ofstreamDestinationBase()
Definition:
G4ofstreamDestination.cc:50
G4bool
bool G4bool
Definition:
G4Types.hh:79
G4ofstreamDestinationBase::SetFileName
void SetFileName(const G4String &name, G4bool append=true)
Definition:
G4ofstreamDestination.cc:55
G4ofstreamDestinationBase::ReceiveG4cerr
virtual G4int ReceiveG4cerr(const G4String &)=0
G4CoutToFile::G4CoutToFile
G4CoutToFile(const G4String &deafaultName="Geant4_cout.txt", G4bool append=true)
Definition:
G4ofstreamDestination.cc:82
G4ofstreamDestinationBase::Open
void Open()
Definition:
G4ofstreamDestination.cc:61
G4ofstreamDestinationBase::ReceiveG4cout
virtual G4int ReceiveG4cout(const G4String &)=0
G4CerrToFile::ReceiveG4cout
virtual G4int ReceiveG4cout(const G4String &)
Definition:
G4ofstreamDestination.hh:88
G4ofstreamDestinationBase
Definition:
G4ofstreamDestination.hh:57
G4CoutToFile::ReceiveG4cout
virtual G4int ReceiveG4cout(const G4String &msg)
Definition:
G4ofstreamDestination.cc:88
G4String
Definition:
G4String.hh:45
geant4.10.03
source
global
management
include
G4ofstreamDestination.hh
Generated on Thu Feb 14 2002 02:28:19 for Geant4 by
1.8.8