GGEMS  1.1
GPU GEant4-based Monte Carlo Simulations
GGEMSTextReader.hh
Go to the documentation of this file.
1 #ifndef GUARD_GGEMS_IO_GGEMSTEXTREADER_HH
2 #define GUARD_GGEMS_IO_GGEMSTEXTREADER_HH
3 
4 // ************************************************************************
5 // * This file is part of GGEMS. *
6 // * *
7 // * GGEMS is free software: you can redistribute it and/or modify *
8 // * it under the terms of the GNU General Public License as published by *
9 // * the Free Software Foundation, either version 3 of the License, or *
10 // * (at your option) any later version. *
11 // * *
12 // * GGEMS is distributed in the hope that it will be useful, *
13 // * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 // * GNU General Public License for more details. *
16 // * *
17 // * You should have received a copy of the GNU General Public License *
18 // * along with GGEMS. If not, see <https://www.gnu.org/licenses/>. *
19 // * *
20 // ************************************************************************
21 
35 #include <fstream>
36 #include <sstream>
37 
39 
44 namespace GGEMSMaterialReader
45 {
52  std::string ReadMaterialName(std::string const& line);
53 
60  GGfloat ReadMaterialDensity(std::string const& line);
61 
68  GGsize ReadMaterialNumberOfElements(std::string const& line);
69 
76  std::string ReadMaterialElementName(std::string const& line);
77 
84  GGfloat ReadMaterialElementFraction(std::string const& line);
85 }
86 
91 namespace GGEMSTextReader
92 {
100  void SkipComment(std::ifstream& stream, std::string& line, char const comment = '#');
101 
108  bool IsBlankLine(std::string const& line);
109 
115  void RemoveSpace(std::string& line);
116 }
117 
122 namespace GGEMSMHDReader
123 {
130  std::string ReadKey(std::string& line);
131 
138  std::istringstream ReadValue(std::string& line);
139 }
140 
145 namespace GGEMSRangeReader
146 {
153  std::istringstream ReadRangeMaterial(std::string& line);
154 }
155 
156 #endif // End of GUARD_GGEMS_IO_GGEMSTEXTREADER_HH
GGEMSTextReader::SkipComment
void SkipComment(std::ifstream &stream, std::string &line, char const comment='#')
skip a special line beginning by a comment caracter
Definition: GGEMSTextReader.cc:131
GGEMSMaterialReader::ReadMaterialNumberOfElements
GGsize ReadMaterialNumberOfElements(std::string const &line)
return the number of elements in material
Definition: GGEMSTextReader.cc:83
GGEMSMaterialReader::ReadMaterialName
std::string ReadMaterialName(std::string const &line)
return the name of the material
Definition: GGEMSTextReader.cc:41
GGsize
#define GGsize
Definition: GGEMSTypes.hh:252
GGEMSMaterialReader::ReadMaterialElementName
std::string ReadMaterialElementName(std::string const &line)
return the name of material element name
Definition: GGEMSTextReader.cc:101
GGEMSRangeReader::ReadRangeMaterial
std::istringstream ReadRangeMaterial(std::string &line)
get string stream of value for material range
Definition: GGEMSTextReader.cc:202
GGEMSMaterialReader::ReadMaterialElementFraction
GGfloat ReadMaterialElementFraction(std::string const &line)
return the number of element fraction
Definition: GGEMSTextReader.cc:114
GGEMSTextReader
namespace reading common text file
GGEMSRangeReader
namespace reading range material in text file
GGEMSTypes.hh
Redefining types for OpenCL device and host.
GGEMSTextReader::RemoveSpace
void RemoveSpace(std::string &line)
remove all spaces and tab from a string
Definition: GGEMSTextReader.cc:156
GGEMSTextReader::IsBlankLine
bool IsBlankLine(std::string const &line)
check if the line is blank or not
Definition: GGEMSTextReader.cc:146
GGEMSMaterialReader::ReadMaterialDensity
GGfloat ReadMaterialDensity(std::string const &line)
return the density of material
Definition: GGEMSTextReader.cc:50
GGEMSMHDReader
namespace reading mhd header
GGEMSMHDReader::ReadKey
std::string ReadKey(std::string &line)
get the key of MHD header
Definition: GGEMSTextReader.cc:176
GGEMSMHDReader::ReadValue
std::istringstream ReadValue(std::string &line)
get string stream of value
Definition: GGEMSTextReader.cc:192
GGfloat
#define GGfloat
Definition: GGEMSTypes.hh:273