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

DCFsbifstream< Data_t > Class Template Reference

#include <DCFsbifstream.h>

Inheritance diagram for DCFsbifstream< Data_t >:

Inheritance graph
[legend]
Collaboration diagram for DCFsbifstream< Data_t >:

Collaboration graph
[legend]

Public Member Functions

void close ()
void close ()
 DCFsbifstream (const string &="_\0")
 DCFsbifstream (const string &="_\0")
void filenamebase (const string &)
void filenamebase (const string &)
void findmpacket (DCFmpBase &, const char mcode, const int n)
void findmpacket (DCFmpacketBase &, const char, const int)
void initmfilepos ()
void initmfilepos ()
bool isopen ()
bool isopen ()
void open ()
void open ()
 ~DCFsbifstream ()
 ~DCFsbifstream ()

Private Attributes

string _filenamebase
string _filenamesb
ifstream * _ifs
int _lenfilenamebase
int_mfilepos
int_mfilepos

template<class Data_t>
class DCFsbifstream< Data_t >


Constructor & Destructor Documentation

template<class Rtmra_t>
DCFsbifstream< Rtmra_t >::DCFsbifstream const string &  = "_\0"  ) 
 

Definition at line 43 of file DCFsbifstream.h.

References DCFsbifstream< Data_t >._filenamebase, DCFsbifstream< Data_t >._lenfilenamebase, and DCFsbifstream< Data_t >._mfilepos.

00044   : DCFsbistream<Data_t>( *( _ifs = new ifstream ) ) 
00045 {
00046     _lenfilenamebase = filenamebase.size();
00047     _filenamebase = filenamebase;
00048     _mfilepos = new int[256];
00049 };

template<class Rtmra_t>
DCFsbifstream< Rtmra_t >::~DCFsbifstream  ) 
 

Definition at line 52 of file DCFsbifstream.h.

References DCFsbifstream< Data_t >._mfilepos.

00053 {
00054    (*_ifs).close();
00055    delete [] _mfilepos; _mfilepos = 0;
00056    delete _ifs; _ifs = 0;
00057 };

template<class Data_t>
DCFsbifstream< Data_t >.DCFsbifstream const string &  = "_\0"  ) 
 

template<class Data_t>
DCFsbifstream< Data_t >.~DCFsbifstream  ) 
 


Member Function Documentation

template<class Data_t>
void DCFsbifstream< Data_t >.close  )  [virtual]
 

Reimplemented from DCFsbistreamBase.

template<class Rtmra_t>
void DCFsbifstream< Rtmra_t >::close  )  [virtual]
 

Reimplemented from DCFsbistreamBase.

Definition at line 83 of file DCFsbifstream.h.

Referenced by DCFsbifstream< Data_t >.open().

00083 { (*_ifs).close(); }

template<class Data_t>
void DCFsbifstream< Data_t >.filenamebase const string &   ) 
 

template<class Rtmra_t>
void DCFsbifstream< Rtmra_t >::filenamebase const string &   ) 
 

Definition at line 60 of file DCFsbifstream.h.

References DCFsbifstream< Data_t >._filenamebase, and DCFsbifstream< Data_t >._lenfilenamebase.

00061 {
00062     _lenfilenamebase = filenamebase.size();
00063     _filenamebase = filenamebase;
00064 };

template<class Rtmra_t>
void DCFsbifstream< Rtmra_t >::findmpacket DCFmpBase ,
const char  mcode,
const int  n
[virtual]
 

Reimplemented from DCFsbistreamBase.

Definition at line 96 of file 2/DCFsbifstream.h.

References DCFsbifstream< Data_t >._mfilepos, DCFmpBase.clear(), and DCFmpBase.empty().

00099 {
00100    bool found = false;
00101    bool missing = false;
00102    bool eof = false;
00103    int nextfilepos;
00104    bytepack bp;
00105 
00106 #ifdef STORM_DEBUG
00107    cout << "DCFsbifstream.findmpacket(): SEARCHING FOR : mcode "
00108         << int( (unsigned char)(mcode) ) << '\n';
00109 #endif
00110 
00111    mp.clear();
00112    (*_is).seekg( _mfilepos[ int( (unsigned char)(mcode) ) ], ios::beg );
00113    int i0 = (*_is).tellg();
00114 
00115    while ( (*_is).good() & !found & !missing & !eof ) {
00116       nextfilepos = (*_is).tellg();
00117       (*_is) >> mp; 
00118 #ifdef STORM_DEBUG
00119       cout << "DCFsbifstream.findmpacket(): mp.mcode() mp.empty() "
00120            << int( (unsigned char)(mp.mcode()) ) << ' ' << mp.empty() << '\n';
00121 #endif
00122 //      if ( mp.empty() ) { 
00123       if ( mp.null() ) { 
00124          (*_is) >> bp( 0, 4 ); 
00125          (*_is) >> bp( 0, 4 );
00126          (*_is) >> bp( 0, _bplen_n ); _finalstep = bp;
00127 #ifdef STORM_DEBUG
00128          cout << "FINALSTEP " << _finalstep << '\n';
00129 #endif
00130          eof = true; 
00131       }
00132       else {
00133          if ( ( mp.mcode() == mcode ) && ( mp.n() == n ) ) {
00134             found=true; 
00135          }
00136          if ( ( mp.mcode() == mcode ) && ( mp.n() > n ) ) {
00137             missing=true; 
00138 //            mp.reset();       HACK ?
00139             mp.clear(); 
00140          }
00141       }
00142    }
00143 
00144    int i1=(*_is).tellg();
00145    if (found) {
00146       _mfilepos[ int( (unsigned char)(mcode) ) ] = (*_is).tellg();
00147    }
00148    else {
00149       _mfilepos[ int( (unsigned char)(mcode) ) ] = nextfilepos;
00150    }
00151 
00152 #ifdef STORM_DEBUG
00153    cout << "DCFsbifstream.findmpacket(): mcode _result_ _mfilepos[mcode] "
00154         << int( (unsigned char)(mcode) );
00155    if (found)  cout << " FOUND ";
00156    if (missing) cout << " MISSING ";
00157    if (eof) cout << " EOF ";
00158    cout << _mfilepos[ int( (unsigned char)(mcode) ) ] << ' ' << n << '\n';
00159 #endif
00160 };

template<class Data_t>
void DCFsbifstream< Data_t >::findmpacket DCFmpacketBase ,
const  char,
const  int
[virtual]
 

Reimplemented from DCFsbistreamBase.

Definition at line 95 of file DCFsbifstream.h.

References DCFsbifstream< Data_t >._mfilepos, DCFmpacketBase.clear(), and DCFmpacketBase.empty().

00100 {
00101    bool found = false;
00102    bool missing = false;
00103    bool eof = false;
00104    int nextfilepos;
00105    bytepack bp;
00106 
00107 #ifdef STORM_DEBUG
00108    cout << "DCFsbifstream.findmpacket(): SEARCHING FOR : mcode "
00109         << int( (unsigned char)(mcode) ) << '\n';
00110 #endif
00111 
00112    mp.clear();
00113    (*_is).seekg( _mfilepos[ int( (unsigned char)(mcode) ) ], ios::beg );
00114    int i0 = (*_is).tellg();
00115 
00116    while ( (*_is).good() & !found & !missing & !eof ) {
00117       nextfilepos = (*_is).tellg();
00118       (*_is) >> mp; 
00119 #ifdef STORM_DEBUG
00120       cout << "DCFsbifstream.findmpacket(): mp.mcode() mp.empty() "
00121            << int( (unsigned char)(mp.mcode()) ) << ' ' << mp.empty() << '\n';
00122 #endif
00123       if ( mp.empty() ) { 
00124          (*_is) >> bp( 0, _bplen_n ); _finalstep = bp;
00125 //       cout << "FINALSTEP " << _finalstep << '\n';
00126          eof = true; 
00127       }
00128       if ( ( mp.mcode() == mcode ) && ( mp.n() == n ) ) {
00129          found=true; 
00130       }
00131       if ( ( mp.mcode() == mcode ) && ( mp.n() > n ) ) {
00132          missing=true; 
00133          mp.reset(); 
00134       }
00135    }
00136 
00137    int i1=(*_is).tellg();
00138    if (found) {
00139       _mfilepos[ int( (unsigned char)(mcode) ) ] = (*_is).tellg();
00140    }
00141    else {
00142       _mfilepos[ int( (unsigned char)(mcode) ) ] = nextfilepos;
00143    }
00144 
00145 #ifdef STORM_DEBUG
00146    cout << "DCFsbifstream.findmpacket(): mcode _result_ _mfilepos[mcode] "
00147         << int( (unsigned char)(mcode) );
00148    if (found)  cout << " FOUND ";
00149    if (missing) cout << " MISSING ";
00150    if (eof) cout << " EOF ";
00151    cout << _mfilepos[ int( (unsigned char)(mcode) ) ] << ' ' << n << '\n';
00152 #endif
00153 };

template<class Data_t>
void DCFsbifstream< Data_t >.initmfilepos  ) 
 

template<class Rtmra_t>
void DCFsbifstream< Rtmra_t >::initmfilepos  ) 
 

Definition at line 86 of file DCFsbifstream.h.

References DCFsbifstream< Data_t >._mfilepos.

Referenced by DCFsbifstream< Data_t >.open().

00087 {
00088    for( int i = 0; i < 256; i++ ) { _mfilepos[i] = (*_is).tellg(); }
00089 #ifdef STORM_DEBUG
00090    cout << " initial seek pos " << _mfilepos[0] << '\n';
00091 #endif
00092 };

template<class Data_t>
bool DCFsbifstream< Data_t >.isopen  )  [virtual]
 

Reimplemented from DCFsbistreamBase.

template<class Rtmra_t>
bool DCFsbifstream< Rtmra_t >::isopen  )  [virtual]
 

Reimplemented from DCFsbistreamBase.

Definition at line 67 of file DCFsbifstream.h.

Referenced by DCFsbifstream< Data_t >.open().

00067 { return (*_ifs).is_open(); }

template<class Data_t>
void DCFsbifstream< Data_t >.open  )  [virtual]
 

Reimplemented from DCFsbistream< Data_t >.

template<class Rtmra_t>
void DCFsbifstream< Rtmra_t >::open  )  [virtual]
 

Reimplemented from DCFsbistream< Data_t >.

Definition at line 70 of file DCFsbifstream.h.

References DCFsbifstream< Data_t >._filenamebase, DCFsbifstream< Data_t >._filenamesb, DCFsbifstream< Data_t >.close(), dcfsbfilename(), DCFsbistream< Data_t >.descr(), DCFsbifstream< Data_t >.initmfilepos(), DCFsbifstream< Data_t >.isopen(), and DCFsbistream< Data_t >.open().

00071 {
00072    if (isopen()) close();
00073    dcfsbfilename( _blocknum, _filenamebase, _filenamesb );
00074    (*_ifs).open( _filenamesb.c_str() );
00075    DCFsbistream<Data_t>::open();
00076    initmfilepos();
00077 //#ifdef STORM_DEBUG
00078    descr();
00079 //#endif
00080 };


Field Documentation

template<class Data_t>
string DCFsbifstream< Data_t >::_filenamebase [private]
 

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

Referenced by DCFsbifstream< Data_t >.DCFsbifstream(), DCFsbifstream< Data_t >.filenamebase(), and DCFsbifstream< Data_t >.open().

template<class Data_t>
string DCFsbifstream< Data_t >::_filenamesb [private]
 

Definition at line 36 of file 2/DCFsbifstream.h.

Referenced by DCFsbifstream< Data_t >.open().

template<class Data_t>
ifstream* DCFsbifstream< Data_t >._ifs [private]
 

Definition at line 38 of file DCFsbifstream.h.

template<class Data_t>
int DCFsbifstream< Data_t >._lenfilenamebase [private]
 

Definition at line 35 of file DCFsbifstream.h.

Referenced by DCFsbifstream< Data_t >.DCFsbifstream(), and DCFsbifstream< Data_t >.filenamebase().

template<class Data_t>
int* DCFsbifstream< Data_t >._mfilepos [private]
 

Definition at line 37 of file 2/DCFsbifstream.h.

template<class Data_t>
int* DCFsbifstream< Data_t >._mfilepos [private]
 

Definition at line 39 of file DCFsbifstream.h.

Referenced by DCFsbifstream< Data_t >.DCFsbifstream(), DCFsbifstream< Data_t >.findmpacket(), DCFsbifstream< Data_t >.initmfilepos(), and DCFsbifstream< Data_t >.~DCFsbifstream().


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