ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4FRofstream.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4FRofstream.hh
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
//
28
#include <fstream>
29
30
#if !defined G4_FR_OFSTREAM_HH
31
#define G4_FR_OFSTREAM_HH
32
33
34
#include "
globals.hh
"
35
37
//typedef int G4bool ;
38
//#define false 0 ;
39
//#define true 1 ;
41
42
class
G4FRofstream
{
43
44
public
:
45
enum
{
SEND_BUFMAX
= 1024 };
46
47
public
:
48
49
// constructors
50
G4FRofstream
() {
flag_file_open
=
false
; }
51
G4FRofstream
(
const
char
*
filename
) ;
52
53
// destructor
54
virtual
~G4FRofstream
();
55
56
// open and close
57
void
Open
(
const
char
*
filename
);
58
void
Close
() ;
59
G4bool
IsOpen
() {
return
flag_file_open
;}
60
61
// utilities
62
void
SendLine
(
const
char
*
string
) ;
// save string with new line
63
64
// static functions
65
static
G4bool
DoesFileExist
(
const
char
*
filename
) ;
66
67
protected
:
68
G4bool
flag_file_open
;
69
std::ofstream
fout
;
70
} ;
71
72
73
inline
void
G4FRofstream::Open
(
const
char
*
filename
)
74
{
75
if
( !
IsOpen
() ) {
76
fout
.open( filename ) ;
77
flag_file_open
=
true
;
78
}
79
}
80
81
82
inline
void
G4FRofstream::Close
()
83
{
84
if
(
IsOpen
() ) {
85
fout
.close();
86
flag_file_open
=
false
;
87
}
88
}
89
90
inline
void
G4FRofstream::SendLine
(
const
char
*
message
)
91
{
92
if
(
IsOpen
() ) {
93
fout
<< message <<
G4endl
;
94
}
95
}
96
97
98
inline
G4bool
G4FRofstream::DoesFileExist
(
const
char
*
filename
)
99
{
100
G4bool
status =
false
;
101
102
std::ifstream fout_tmp( filename ) ;
103
if
( fout_tmp ) { status =
true
; }
104
fout_tmp.close();
105
106
return
status ;
107
}
108
109
110
inline
111
G4FRofstream::G4FRofstream
(
const
char
*
filename
)
112
{
113
flag_file_open
=
false
;
114
Open
( filename );
115
}
116
117
inline
118
G4FRofstream::~G4FRofstream
()
119
{
120
Close
() ;
121
}
122
123
124
#endif
geant4
tree
geant4-10.6-release
source
visualization
FukuiRenderer
include
G4FRofstream.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:54
using
1.8.2 with
ECCE GitHub integration