37 _lengthoftokenlist = 0;
57 fin.open( filename.c_str() );
60 report(
ERROR,
"EvtGen" ) <<
"Could not open file '" << filename.c_str() <<
"'" << endl;
71 while ( fin.peek() != EOF )
76 while ( ( c = fin.get() ) !=
'\n' && i <
MAXBUF )
82 {
report(
ERROR,
"EvtGen" ) <<
"Error in EvtParser: line:" << line <<
" to long" << endl; }
83 else { buf[i] =
'\0'; }
88 if ( buf[i] ==
'#' ) buf[i] = 0;
90 }
while ( buf[i - 1] != 0 );
93 istrstream ist( buf, strlen( buf ) );
104 }
while ( buf2[i++] != 0 );
105 if ( buf2[0] != 0 ) { addToken( line, buf2 ); }
106 if ( semicolon ) addToken( line,
";" );
115void EvtParser::addToken(
int line,
const std::string&
string ) {
119 if ( _ntoken == _lengthoftokenlist )
122 int new_length = 1000 + 4 * _lengthoftokenlist;
124 int* newlinelist =
new int[new_length];
125 std::string* newtokenlist =
new std::string[new_length];
129 for ( i = 0; i < _ntoken; i++ )
131 newlinelist[i] = _linelist[i];
132 newtokenlist[i] = _tokenlist[i];
138 _tokenlist = newtokenlist;
139 _linelist = newlinelist;
141 _lengthoftokenlist = new_length;
144 _tokenlist[_ntoken] = string;
146 _linelist[_ntoken] = line;
ostream & report(Severity severity, const char *facility)
int getLineofToken(int i)
const std::string & getToken(int i)
int Read(const std::string filename)