Public Member Functions | |
InputFile (G4String filename, G4int _maxline=1024) | |
~InputFile () | |
const char * | filename () |
bool | good () |
int | linenumber () |
char * | getline () |
void | setMaxline (int _maxline) |
void | close () |
void | repeatLine () |
Private Attributes | |
std::ifstream | in |
G4String | name |
char * | line |
int | maxline |
int | lineno |
bool | repeatline |
class InputFile handles input file I/O
Definition at line 32 of file MyBLFieldMap.cc.
InputFile::InputFile | ( | G4String | filename, | |
G4int | _maxline = 1024 | |||
) | [inline] |
Definition at line 40 of file MyBLFieldMap.cc.
InputFile::~InputFile | ( | ) | [inline] |
void InputFile::close | ( | ) | [inline] |
Definition at line 77 of file MyBLFieldMap.cc.
Referenced by MyBLFieldMap::readFile(), and ~InputFile().
const char* InputFile::filename | ( | ) | [inline] |
Definition at line 50 of file MyBLFieldMap.cc.
References name.
Referenced by MyBLFieldMap::readFile().
00050 { return name.c_str(); }
char* InputFile::getline | ( | ) | [inline] |
Definition at line 53 of file MyBLFieldMap.cc.
References in, line, lineno, maxline, and repeatline.
Referenced by CylinderImpl::handleCommand(), GridImpl::handleCommand(), FieldMapImpl::readBlock(), MyBLFieldMap::readFile(), and TimeImpl::readTime().
00053 { // skips blank lines and comments 00054 if(repeatline) { 00055 repeatline = false; 00056 return line; 00057 } 00058 while(in.good()) { 00059 line[0] = '\0'; 00060 in.getline(line,maxline); 00061 ++lineno; 00062 if(line[0] == '*') 00063 printf("%s\n",line); 00064 if(line[0] == '\0' || line[0] == '#' || line[0] == '*') 00065 continue; 00066 return line; 00067 } 00068 return 0; 00069 }
bool InputFile::good | ( | ) | [inline] |
Definition at line 51 of file MyBLFieldMap.cc.
References in.
Referenced by MyBLFieldMap::readFile().
00051 { return in.good(); }
int InputFile::linenumber | ( | ) | [inline] |
Definition at line 52 of file MyBLFieldMap.cc.
References lineno.
Referenced by CylinderImpl::handleCommand(), GridImpl::handleCommand(), and MyBLFieldMap::readFile().
00052 { return lineno; }
void InputFile::repeatLine | ( | ) | [inline] |
Definition at line 82 of file MyBLFieldMap.cc.
References repeatline.
Referenced by CylinderImpl::handleCommand(), GridImpl::handleCommand(), and TimeImpl::readTime().
00082 { repeatline = true; }
void InputFile::setMaxline | ( | int | _maxline | ) | [inline] |
std::ifstream InputFile::in [private] |
Definition at line 33 of file MyBLFieldMap.cc.
Referenced by close(), getline(), good(), and InputFile().
char* InputFile::line [private] |
Definition at line 35 of file MyBLFieldMap.cc.
Referenced by close(), getline(), InputFile(), and setMaxline().
int InputFile::lineno [private] |
Definition at line 37 of file MyBLFieldMap.cc.
Referenced by getline(), InputFile(), and linenumber().
int InputFile::maxline [private] |
Definition at line 36 of file MyBLFieldMap.cc.
Referenced by getline(), InputFile(), and setMaxline().
G4String InputFile::name [private] |
Definition at line 34 of file MyBLFieldMap.cc.
Referenced by filename(), and InputFile().
bool InputFile::repeatline [private] |
Definition at line 38 of file MyBLFieldMap.cc.
Referenced by getline(), InputFile(), and repeatLine().