Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4FRofstream Class Reference

#include <G4FRofstream.hh>

Public Types

enum  { SEND_BUFMAX = 1024 }
 

Public Member Functions

 G4FRofstream ()
 
 G4FRofstream (const char *filename)
 
virtual ~G4FRofstream ()
 
void Open (const char *filename)
 
void Close ()
 
G4bool IsOpen ()
 
void SendLine (const char *string)
 

Static Public Member Functions

static G4bool DoesFileExist (const char *filename)
 

Protected Attributes

G4bool flag_file_open
 
std::ofstream fout
 

Detailed Description

Definition at line 43 of file G4FRofstream.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
SEND_BUFMAX 

Definition at line 46 of file G4FRofstream.hh.

46{ SEND_BUFMAX = 1024 };

Constructor & Destructor Documentation

◆ G4FRofstream() [1/2]

G4FRofstream::G4FRofstream ( )
inline

Definition at line 51 of file G4FRofstream.hh.

51{ flag_file_open = false ; }
G4bool flag_file_open
Definition: G4FRofstream.hh:69

◆ G4FRofstream() [2/2]

G4FRofstream::G4FRofstream ( const char *  filename)
inline

Definition at line 112 of file G4FRofstream.hh.

113{
114 flag_file_open = false ;
115 Open( filename );
116}
void Open(const char *filename)
Definition: G4FRofstream.hh:74

◆ ~G4FRofstream()

G4FRofstream::~G4FRofstream ( )
inlinevirtual

Definition at line 119 of file G4FRofstream.hh.

120{
121 Close() ;
122}

Member Function Documentation

◆ Close()

void G4FRofstream::Close ( )
inline

Definition at line 83 of file G4FRofstream.hh.

84{
85 if( IsOpen() ) {
86 fout.close();
87 flag_file_open = false ;
88 }
89}
G4bool IsOpen()
Definition: G4FRofstream.hh:60
std::ofstream fout
Definition: G4FRofstream.hh:70

Referenced by G4DAWNFILEViewer::ClearView(), G4DAWNFILESceneHandler::EndSavingG4Prim(), and ~G4FRofstream().

◆ DoesFileExist()

G4bool G4FRofstream::DoesFileExist ( const char *  filename)
inlinestatic

Definition at line 99 of file G4FRofstream.hh.

100{
101 G4bool status = false ;
102
103 std::ifstream fout_tmp( filename ) ;
104 if( fout_tmp ) { status = true ; }
105 fout_tmp.close();
106
107 return status ;
108}
bool G4bool
Definition: G4Types.hh:67

Referenced by G4DAWNFILEViewer::ShowView().

◆ IsOpen()

G4bool G4FRofstream::IsOpen ( )
inline

◆ Open()

void G4FRofstream::Open ( const char *  filename)
inline

Definition at line 74 of file G4FRofstream.hh.

75{
76 if( !IsOpen() ) {
77 fout.open( filename ) ;
78 flag_file_open = true ;
79 }
80}

Referenced by G4DAWNFILESceneHandler::BeginSavingG4Prim(), G4DAWNFILEViewer::ClearView(), and G4FRofstream().

◆ SendLine()

void G4FRofstream::SendLine ( const char *  string)
inline

Definition at line 91 of file G4FRofstream.hh.

92{
93 if ( IsOpen() ) {
94 fout << message << G4endl;
95 }
96}
#define G4endl
Definition: G4ios.hh:52

Member Data Documentation

◆ flag_file_open

G4bool G4FRofstream::flag_file_open
protected

Definition at line 69 of file G4FRofstream.hh.

Referenced by Close(), G4FRofstream(), IsOpen(), and Open().

◆ fout

std::ofstream G4FRofstream::fout
protected

Definition at line 70 of file G4FRofstream.hh.

Referenced by Close(), Open(), and SendLine().


The documentation for this class was generated from the following file: