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 "MCF_Code.h"
00015
00016 #include "MCFsbistreamBase.h"
00017
00018 MCFsbistreamBase::MCFsbistreamBase( istream& is )
00019 : _openfail(false),
00020 _version(0), _revision(2), _release(0), _author(0), _descript(""),
00021 _arraydim(0), _sbn(0),
00022 _mmin_this(0), _mmax_this(31), _mmin_exist(0), _mmax_exist(31),
00023 _mmin_theory(0), _mmax_theory(31),
00024 _cmin_this(0), _cmax_this(255), _cmin_exist(0), _cmax_exist(255),
00025 _cmin_theory(0), _cmax_theory(255),
00026 _bplen_mpsizeb(2), _bplen_coef(8),
00027 _datatype_code(MCF_CODE_UNKNOWN),
00028 _bplen_n(2), _bplen_a(2),
00029 _is(&is)
00030 {
00031 #ifdef STORM_DEBUG
00032 cout << "MCFsbistreamBase Constructor.\n";
00033 #endif
00034
00035 _finalstep = -1;
00036 }
00037
00038 void MCFsbistreamBase::report( ostream& os )
00039 {
00040 os << "MCFsbistreamBase::report():\n";
00041 os << " MCF REPORT version= " <<_version << endl;
00042 os << " MCF REPORT revision= " << _revision << endl;
00043 os << " MCF REPORT release= " << _release << endl;
00044 os << " MCF REPORT author= " << _author << endl;
00045 os << " MCF REPORT descript.size()= " << _descript.size() << endl;
00046 os << " MCF REPORT descript= " << _descript << endl;
00047
00048 os << " MCF REPORT arraydim= " << _arraydim << endl;
00049 os << " MCF REPORT bplen_mpsizeb= " << _bplen_mpsizeb << endl;
00050 os << " MCF REPORT bplen_coef= " << _bplen_coef << endl;
00051 os << " MCF REPORT bplen_n= " << _bplen_n << endl;
00052 for( int d = 0; d < _arraydim; ++d ) {
00053 os << " MCF REPORT bplen_a[" << d << "]= " << _bplen_a << endl;
00054 }
00055
00056 os << " MCF REPORT sbn= " << _sbn << endl;
00057 os << " MCF REPORT mmin_this= " << _mmin_this << endl;
00058 os << " MCF REPORT mmax_this= " << _mmax_this << endl;
00059 os << " MCF REPORT mmin_exist= " << _mmin_exist << endl;
00060 os << " MCF REPORT mmax_exist= " << _mmax_exist << endl;
00061 os << " MCF REPORT mmin_theory= " << _mmin_theory << endl;
00062 os << " MCF REPORT mmax_theory= " << _mmax_theory << endl;
00063 os << " MCF REPORT cmin_this= " << _cmin_this << endl;
00064 os << " MCF REPORT cmax_this= " << _cmax_this << endl;
00065 os << " MCF REPORT cmin_exist= " << _cmin_exist << endl;
00066 os << " MCF REPORT cmax_exist= " << _cmax_exist << endl;
00067 os << " MCF REPORT cmin_theory= " << _cmin_theory << endl;
00068 os << " MCF REPORT cmax_theory= " << _cmax_theory << endl;
00069 os << " MCF REPORT datatype_code= " << _datatype_code << endl;
00070
00071 os << " MCF REPORT finalstep=" << _finalstep << '\n';
00072 };
00073
00074 void MCFsbistreamBase::inheader()
00075 {
00076 char c;
00077 bytepack bp;
00078
00079 char ptc[9];
00080 for( int i = 0; i < 8; i++ ) {
00081 (*_is) >> ptc[i];
00082 #ifdef STORM_DEBUG
00083 cout << ptc[i];
00084 #endif
00085 }
00086 ptc[8] = 0;
00087 if ( strcmp(ptc,"MCF_____\0") ) {
00088 cout << ptc << " not a MCFsb file!\n";
00089 }
00090
00091 (*_is) >> bp( 0, 4 ); int mcfsizeb1 = int(bp);
00092
00093 (*_is) >> bp( 0, 1 ); _version = int(bp);
00094 (*_is) >> bp( 0, 1 ); _revision = int(bp);
00095 (*_is) >> bp( 0, 1 ); _release = int(bp);
00096 (*_is) >> bp( 0, 1 ); _author = int(bp);
00097
00098 (*_is) >> bp( 0, 1 ); int ii = int(bp);
00099 _descript="";
00100 for( int i = 0; i < ii; i++ ) {
00101 (*_is).get(c);
00102 _descript += c;
00103 }
00104
00105
00106 (*_is) >> bp( 0, 4 ); int sbsizeb1 = int(bp);
00107
00108 (*_is) >> bp( 0, 1 );
00109 (*_is) >> bp( 0, 1 ); _arraydim = int(bp);
00110 (*_is) >> bp( 0, 1 ); _bplen_mpsizeb = int(bp);
00111 (*_is) >> bp( 0, 1 ); _bplen_coef = int(bp);
00112 (*_is) >> bp( 0, 1 ); _bplen_n = int(bp);
00113 for( int d = 0; d < _arraydim; ++d ) {
00114 (*_is) >> bp( 0, 1 ); _bplen_a = int(bp);
00115 }
00116
00117 (*_is) >> bp( 0, 4 ); _sbn = int(bp);
00118 (*_is) >> bp( 0, 1 ); _mmin_this = int(bp);
00119 (*_is) >> bp( 0, 1 ); _mmax_this = int(bp);
00120 (*_is) >> bp( 0, 1 ); _mmin_exist = int(bp);
00121 (*_is) >> bp( 0, 1 ); _mmax_exist = int(bp);
00122 (*_is) >> bp( 0, 1 ); _mmin_theory = int(bp);
00123 (*_is) >> bp( 0, 1 ); _mmax_theory = int(bp);
00124 (*_is) >> bp( 0, 1 ); _cmin_this = int(bp);
00125 (*_is) >> bp( 0, 1 ); _cmax_this = int(bp);
00126 (*_is) >> bp( 0, 1 ); _cmin_exist = int(bp);
00127 (*_is) >> bp( 0, 1 ); _cmax_exist = int(bp);
00128 (*_is) >> bp( 0, 1 ); _cmin_theory = int(bp);
00129 (*_is) >> bp( 0, 1 ); _cmax_theory = int(bp);
00130 (*_is) >> bp( 0, 1 ); int datatype_code = int(bp);
00131 (*_is) >> bp( 0, 1 );
00132 (*_is) >> bp( 0, 1 );
00133 (*_is) >> bp( 0, 1 );
00134
00135
00136 _finalstep = -1;
00137
00138 if (datatype_code != _datatype_code )
00139 cout << "MCFsbistreamBase::inheader(): WARNING: datatype_code mismatch\n";
00140
00141 };
00142