00001
00002
00003
00004
00005
00006
00007 #ifdef USE_STD
00008 #include <string>
00009 using namespace std;
00010 #else
00011 #include <string.h>
00012 #endif
00013
00014 #include "DCFsbistreamBase.h"
00015
00016 DCFsbistreamBase::DCFsbistreamBase( istream& is)
00017 : _version(0), _revision(0), _author(0),
00018 _blocknum(0), _mthis0(0), _mthis1(0), _mmax(0),
00019 _bplen_sizeb(1), _bplen_n(1),
00020 _enctype(0), _encsizeb(2),
00021 _is(&is)
00022 {
00023 #ifdef STORM_DEBUG
00024 cout << "DCFsbistreamBase Constructor.\n";
00025 #endif
00026 _descript = "\0";
00027 _lendescript=_descript.size();
00028 _finalstep =( 1 << _mmax ) - 1;
00029 }
00030
00031 void DCFsbistreamBase::descr()
00032 {
00033 cout << "DCFsbistream<>::descr();\n";
00034 cout << " version=" <<_version << '\n';
00035 cout << " revision=" << _revision << '\n';
00036 cout << " author=" << _author << '\n';
00037 cout << " lendescript=" << _lendescript << '\n';
00038 cout << " descript=" << _descript << '\n';
00039 cout << " blocknum=" << _blocknum << '\n';
00040 cout << " mthis0=" << _mthis0 << '\n';
00041 cout << " mthis1=" << _mthis1 << '\n';
00042 cout << " mmax=" << _mmax << '\n';
00043 cout << " bplen_sizeb=" << _bplen_sizeb << '\n';
00044 cout << " bplen_n=" << _bplen_n << '\n';
00045
00046 cout << " enctype=" << _enctype << '\n';
00047 cout << " encsizeb=" << _encsizeb << '\n';
00048 cout << " finalstep=" << _finalstep << '\n';
00049 };
00050
00051
00052 void DCFsbistreamBase::open()
00053 {
00054 char c;
00055 char ptc[7];
00056 bytepack bp;
00057
00058 for( int i = 0; i < 6; i++ ) {
00059 (*_is) >> ptc[i];
00060 #ifdef STORM_DEBUG
00061 cout << ptc[i];
00062 #endif
00063 }
00064
00065 ptc[6] = 0;
00066
00067 if ( strcmp(ptc,"DCFsb_\0") ) {
00068 cout << "not a DCFsb file!\n";
00069 }
00070
00071 (*_is) >> bp(0,1); _version = bp;
00072 (*_is) >> bp(0,1); _revision = bp;
00073 (*_is) >> bp(0,2); _author = bp;
00074 (*_is) >> bp(0,1); _lendescript = bp;
00075
00076 _descript="";
00077 for( int i = 0; i < _lendescript; i++ ) {
00078 (*_is).get(c);
00079 _descript += c;
00080 }
00081
00082 (*_is) >> bp(0,2); _blocknum = bp;
00083 (*_is) >> bp(0,1); _mthis0 = bp;
00084 (*_is) >> bp(0,1); _mthis1 = bp;
00085 (*_is) >> bp(0,1); _mmax = bp;
00086 (*_is) >> bp(0,1); _bplen_sizeb = bp;
00087 (*_is) >> bp(0,1); _bplen_n = bp;
00088
00089 (*_is) >> bp(0,1); _enctype = bp;
00090 (*_is) >> bp(0,1); _encsizeb = bp;
00091
00092 _finalstep = ( 1 << _mmax ) - 1;
00093 };
00094