Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals

DCFlogifstream Class Reference

#include <DCFlogifstream.h>

Collaboration diagram for DCFlogifstream:

Collaboration graph
[legend]

Public Member Functions

 DCFlogifstream (const string filenamebase)
 DCFlogifstream (const string filenamebase)
int getarg (const int narg, const string line, string arg)
int getarg (const int narg, const string line, string arg)
int nextDCF (string line)
int nextDCF (string line)
int nextUSR (string line)
int nextUSR (string line)
void resetDCF ()
void resetDCF ()
void resetUSR ()
void resetUSR ()
 ~DCFlogifstream ()
 ~DCFlogifstream ()

Private Attributes

int _dcfeof
int _dcffilepos
string _filenamelog
int _filenotfound
ifstream * _ifs
ifstream * _ifs
int _usreof
int _usrfilepos

Constructor & Destructor Documentation

DCFlogifstream::DCFlogifstream const string  filenamebase  ) 
 

Definition at line 26 of file DCFlogifstream.cpp.

References _filenamelog, _filenotfound, _ifs, and dcflogfilename().

00027   : _dcffilepos(0), _dcfeof(0), _usrfilepos(0), _usreof(0)
00028 { 
00029    dcflogfilename( filenamebase, _filenamelog );
00030    _ifs = new ifstream( _filenamelog.c_str() );
00031    (*_ifs).good() ? _filenotfound = 0 : _filenotfound = 1;
00032 };

DCFlogifstream::~DCFlogifstream  ) 
 

Definition at line 34 of file DCFlogifstream.cpp.

References _ifs.

00035 { 
00036    delete _ifs;
00037 };

DCFlogifstream.DCFlogifstream const string  filenamebase  ) 
 

DCFlogifstream.~DCFlogifstream  ) 
 


Member Function Documentation

int DCFlogifstream.getarg const int  narg,
const string  line,
string  arg
 

int DCFlogifstream::getarg const int  narg,
const string  line,
string  arg
 

Definition at line 113 of file DCFlogifstream.cpp.

References j.

00114 {
00115    int i = 0;
00116    int found = 0;
00117    int eol = 0;
00118    int iarg = 0;
00119 
00120    int j;
00121    char c;
00122 
00123    while ( found==0 && eol==0 ) {
00124       c = ' '; 
00125 
00126       while ( c == ' ' ) { c = line[i++]; }
00127 
00128       arg="";
00129       while ( ( c != ' ' ) && ( i < line.size() ) ) { 
00130          arg += c;
00131          c = line[i++]; 
00132       }
00133 
00134       if ( i == line.size() ) eol = 1;
00135       if ( (++iarg) == narg ) found = 1;
00136    }
00137 
00138    if ( found == 0 ) arg = "";
00139 
00140    return !found;
00141 
00142 };

int DCFlogifstream.nextDCF string  line  ) 
 

int DCFlogifstream::nextDCF string  line  ) 
 

Definition at line 39 of file DCFlogifstream.cpp.

References _dcfeof, _dcffilepos, and _filenotfound.

00040 {
00041    if ( ( _filenotfound == 1 ) || ( _dcfeof == 1 ) ) return 1;
00042 
00043    string tmpbuf="";
00044 
00045    int found = 0;
00046    (*_ifs).seekg( _dcffilepos, ios::beg );
00047   
00048    int i; 
00049    char c;
00050 
00051    while ( ( found == 0 ) && ( _dcfeof == 0 ) ) {
00052       c=' '; 
00053       i=0;
00054       while ( ( c == ' ' ) && (*_ifs).good() ) { (*_ifs).get(c); }
00055       while ( ( c != ' ' ) && ( c != 10 ) && (*_ifs).good() ) { 
00056          tmpbuf += c; 
00057          (*_ifs).get(c); 
00058       }
00059       if ( (*_ifs).eof() ) _dcfeof = 1;
00060       if ( tmpbuf == "DCF" ) found = 1;
00061          c=' '; 
00062          i=0;
00063          while ( ( c == ' ' ) && (*_ifs).good() ) { (*_ifs).get(c); }
00064          while ( ( c != 10 ) && (*_ifs).good() ) { 
00065             tmpbuf += c; 
00066             (*_ifs).get(c); 
00067          }
00068    }
00069 
00070    if ( (*_ifs).eof() ) _dcfeof=1;
00071    line = tmpbuf;
00072    _dcffilepos = (*_ifs).tellg();
00073    (*_ifs).clear();
00074    return _dcfeof;
00075 };

int DCFlogifstream.nextUSR string  line  ) 
 

int DCFlogifstream::nextUSR string  line  ) 
 

Definition at line 77 of file DCFlogifstream.cpp.

References _filenotfound, _usreof, and _usrfilepos.

00078 {
00079    if ( ( _filenotfound == 1 ) || ( _usreof == 1 ) ) return 1;
00080    string tmpbuf="";
00081    int found=0;
00082    (*_ifs).seekg( _usrfilepos, ios::beg );
00083 
00084    int i;
00085    char c;
00086 
00087    while ( ( found == 0 ) && ( _usreof == 0 ) ) {
00088       c=' '; 
00089       i=0;
00090       while ( ( c == ' ' ) && (*_ifs).good() ) { (*_ifs).get(c); }
00091       while ( ( c != ' ' ) && ( c != 10 ) && (*_ifs).good() ) { 
00092          tmpbuf += c; 
00093          (*_ifs).get(c); 
00094       }
00095       if ( (*_ifs).eof() ) _usreof = 1;
00096       if ( tmpbuf == "USR" ) found = 1;
00097       c = ' '; 
00098       i = 0;
00099       while ( ( c == ' ' ) && (*_ifs).good() ) { (*_ifs).get(c); }
00100       while ( ( c != 10 ) && (*_ifs).good() ) { 
00101          tmpbuf += c; 
00102          (*_ifs).get(c); 
00103       }
00104    }
00105 
00106    if ( (*_ifs).eof() ) _usreof = 1;
00107    line = tmpbuf;
00108    _usrfilepos = (*_ifs).tellg();
00109    (*_ifs).clear();
00110    return _usreof;
00111 };

void DCFlogifstream.resetDCF  ) 
 

void DCFlogifstream::resetDCF  ) 
 

Definition at line 22 of file DCFlogifstream.h.

References _dcfeof, and _dcffilepos.

00022 : _dcffilepos(0), _dcfeof(0) {}

void DCFlogifstream.resetUSR  ) 
 

void DCFlogifstream::resetUSR  ) 
 

Definition at line 23 of file DCFlogifstream.h.

References _usreof, and _usrfilepos.

00023 : _usrfilepos(0), _usreof(0) {}


Field Documentation

int DCFlogifstream::_dcfeof [private]
 

Definition at line 32 of file 2/DCFlogifstream.h.

Referenced by nextDCF(), and resetDCF().

int DCFlogifstream::_dcffilepos [private]
 

Definition at line 33 of file 2/DCFlogifstream.h.

Referenced by nextDCF(), and resetDCF().

string DCFlogifstream::_filenamelog [private]
 

Definition at line 29 of file 2/DCFlogifstream.h.

Referenced by DCFlogifstream().

int DCFlogifstream::_filenotfound [private]
 

Definition at line 31 of file 2/DCFlogifstream.h.

Referenced by DCFlogifstream(), nextDCF(), and nextUSR().

ifstream* DCFlogifstream._ifs [private]
 

Definition at line 30 of file 2/DCFlogifstream.h.

ifstream* DCFlogifstream._ifs [private]
 

Definition at line 30 of file DCFlogifstream.h.

Referenced by DCFlogifstream(), and ~DCFlogifstream().

int DCFlogifstream::_usreof [private]
 

Definition at line 34 of file 2/DCFlogifstream.h.

Referenced by nextUSR(), and resetUSR().

int DCFlogifstream::_usrfilepos [private]
 

Definition at line 35 of file 2/DCFlogifstream.h.

Referenced by nextUSR(), and resetUSR().


The documentation for this class was generated from the following files:
Generated on Mon May 31 21:40:49 2004 for SR2k4 Assembler by doxygen 1.3.6