Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4CsvRFileManager Class Reference

#include <G4CsvRFileManager.hh>

Inheritance diagram for G4CsvRFileManager:
Collaboration diagram for G4CsvRFileManager:

Public Member Functions

 G4CsvRFileManager (const G4AnalysisManagerState &state)
 
 ~G4CsvRFileManager ()
 
virtual G4bool OpenRFile (const G4String &fileName)
 
std::ifstream * GetRFile (const G4String &fileName) const
 
- Public Member Functions inherited from G4BaseFileManager
 G4BaseFileManager (const G4AnalysisManagerState &state)
 
virtual ~G4BaseFileManager ()
 
virtual G4bool SetFileName (const G4String &fileName)
 
G4String GetFileName () const
 
G4String GetFullFileName (const G4String &baseFileName="", G4bool isPerThread=true) const
 
G4String GetHnFileName (const G4String &hnType, const G4String &hnName) const
 
G4String GetNtupleFileName (const G4String &ntupleName) const
 
G4String GetNtupleFileName (G4int ntupleFileNumber) const
 
G4String GetPlotFileName () const
 
G4String GetFileType () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4BaseFileManager
G4String TakeOffExtension (G4String &name) const
 
- Protected Attributes inherited from G4BaseFileManager
const G4AnalysisManagerStatefState
 
G4String fFileName
 

Detailed Description

Definition at line 43 of file G4CsvRFileManager.hh.

Constructor & Destructor Documentation

G4CsvRFileManager::G4CsvRFileManager ( const G4AnalysisManagerState state)
explicit

Definition at line 34 of file G4CsvRFileManager.cc.

35  : G4BaseFileManager(state),
36  fRFiles()
37 {
38 }
G4BaseFileManager(const G4AnalysisManagerState &state)
G4CsvRFileManager::~G4CsvRFileManager ( )

Definition at line 41 of file G4CsvRFileManager.cc.

42 {
43  for (G4int i=0; i<G4int(fRFiles.size()); ++i) {
44  delete fRFiles[i];
45  }
46 }
int G4int
Definition: G4Types.hh:78

Member Function Documentation

std::ifstream * G4CsvRFileManager::GetRFile ( const G4String fileName) const

Definition at line 91 of file G4CsvRFileManager.cc.

92 {
93  std::map<G4String, std::ifstream*>::const_iterator it
94  = fRFiles.find(fileName);
95  if ( it != fRFiles.end() )
96  return it->second;
97  else {
98  return nullptr;
99  }
100 }

Here is the caller graph for this function:

G4bool G4CsvRFileManager::OpenRFile ( const G4String fileName)
virtual

Definition at line 53 of file G4CsvRFileManager.cc.

54 {
55 #ifdef G4VERBOSE
56  if ( fState.GetVerboseL4() )
57  fState.GetVerboseL4()->Message("open", "read analysis file", fileName);
58 #endif
59 
60  // create new file
61  std::ifstream* newFile = new std::ifstream(fileName);
62  if ( ! newFile->is_open() ) {
63  G4ExceptionDescription description;
64  description << " " << "Cannot open file " << fileName;
65  G4Exception("G4CsvAnalysisReader::OpenRFile()",
66  "Analysis_WR001", JustWarning, description);
67  return false;
68  }
69 
70  // add file in a map and delete the previous file if it exists
71  std::map<G4String, std::ifstream*>::iterator it
72  = fRFiles.find(fileName);
73  if ( it != fRFiles.end() ) {
74  delete it->second;
75  it->second = newFile;
76  }
77  else {
78  fRFiles[fileName] = newFile;
79  }
80 
81 #ifdef G4VERBOSE
82  if ( fState.GetVerboseL1() )
84  ->Message("open", "read analysis file", fileName);
85 #endif
86 
87  return true;
88 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
const G4AnalysisManagerState & fState
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4AnalysisVerbose * GetVerboseL4() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4AnalysisVerbose * GetVerboseL1() const

Here is the call graph for this function:

Here is the caller graph for this function:


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