36 _lengthoftokenlist = 0;
66 fin.open( filename.c_str() );
69 <<
"Could not open file '" << filename.c_str() <<
"'" << endl;
80 while ( fin.peek() != EOF ) {
84 while ( ( c = fin.get() ) !=
'\n' && c != EOF && i <
MAXBUF ) {
90 <<
"Error in EvtParser: line:" << line <<
" to long" << endl;
101 }
while ( buf[i - 1] != 0 );
103 string tmp( buf, strlen( buf ) );
106 istringstream ist( tmp );
107 while ( ist >> buf2 ) {
111 if ( buf2[i] ==
';' ) {
115 }
while ( buf2[i++] != 0 );
116 if ( buf2[0] != 0 ) {
117 addToken( line, buf2 );
120 addToken( line,
";" );
133 if ( _ntoken == _lengthoftokenlist ) {
134 int new_length = 1000 + 4 * _lengthoftokenlist;
136 int* newlinelist =
new int[new_length];
137 std::string* newtokenlist =
new std::string[new_length];
141 for ( i = 0; i < _ntoken; i++ ) {
142 newlinelist[i] = _linelist[i];
143 newtokenlist[i] = _tokenlist[i];
149 _tokenlist = newtokenlist;
150 _linelist = newlinelist;
152 _lengthoftokenlist = new_length;
155 _tokenlist[_ntoken] = string;
157 _linelist[_ntoken] = line;
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=0)
int read(const std::string filename)
void addToken(int line, const std::string &string)
int getLineofToken(int i)
const std::string & getToken(int i)