|
||||
File indexing completed on 2025-01-18 09:59:10
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // G4tgrFileIn 0027 // 0028 // Class description: 0029 // 0030 // Singleton for importing file descriptions. 0031 0032 // Author: P.Arce, CIEMAT (November 2007) 0033 // -------------------------------------------------------------------- 0034 #ifndef G4tgrFileIn_hh 0035 #define G4tgrFileIn_hh 1 0036 0037 #include <vector> 0038 0039 #include "globals.hh" 0040 0041 class G4tgrFileIn 0042 { 0043 public: 0044 0045 G4tgrFileIn(); 0046 ~G4tgrFileIn(); 0047 0048 static G4tgrFileIn& GetInstance(const G4String& name); 0049 // Get the only instance opening the file 0050 0051 static G4tgrFileIn& GetInstanceOpened(const G4String& name); 0052 // Get the only instance when file should be already opened 0053 0054 G4int GetWordsInLine(std::vector<G4String>& wl); 0055 // Read a line and transform it to a vector of words 0056 0057 void ErrorInLine(); 0058 // Print out an error message indicating the line being read 0059 0060 // Access data members 0061 0062 G4int Nline() { return theLineNo[theCurrentFile]; } 0063 0064 const G4String& GetName() { return theName; } 0065 0066 void OpenNewFile(const char* filename); 0067 G4bool EndOfFile(); 0068 void Close(); 0069 void DumpException(const G4String& sent); 0070 0071 private: 0072 0073 G4tgrFileIn(const G4String& name) : theName(name) {} 0074 0075 private: 0076 0077 std::vector<std::ifstream*> theFiles; 0078 0079 std::vector<G4int> theLineNo; 0080 // Number of line being read 0081 0082 std::vector<G4String> theNames; 0083 0084 G4int theCurrentFile = -1; 0085 // Index of file being read in theFiles 0086 0087 static G4ThreadLocal std::vector<G4tgrFileIn*>* theInstances; 0088 // Vector of class instances (each one identified by its name) 0089 0090 G4String theName = ""; 0091 // Name of file 0092 }; 0093 0094 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |