00001
00002
00003
00004
00005
00006
00007 #ifndef MCFSBOSTREAMBASE_H
00008 #define MCFSBOSTREAMBASE_H
00009
00010 #ifdef USE_STD
00011 #include <iostream>
00012 #include <string>
00013 using namespace std;
00014 #else
00015 #include <iostream.h>
00016 #include <string.h>
00017 #endif
00018
00019 #include "MCF_Code.h"
00020
00021 class MCFsbostreamBase
00022 {
00023 public:
00024
00025 MCFsbostreamBase( const string& descript = "_", ostream& os = cout );
00026
00027 virtual ~MCFsbostreamBase();
00028
00029 void set_author( const int author);
00030
00031 void set_descript( const string& );
00032
00033 void set_sbn( const int sbn );
00034
00035 void set_mpart(
00036 const int mmin_this, const int mmax_this,
00037 const int mmin_exist, const int mmax_exist,
00038 const int mmin_theory, const int mmax_theory
00039 );
00040
00041 void set_cpart(
00042 const int cmin_this, const int cmax_this,
00043 const int cmin_exist, const int cmax_exist,
00044 const int cmin_theory, const int cmax_theory
00045 );
00046
00047 void set_bplen(
00048 const int bplen_mpsizeb, const int bplen_coef,
00049 const int bplen_n, const int bplen_a
00050 );
00051
00052 void finalstep( const int );
00053 int finalstep();
00054
00055 virtual void report( ostream& = cout );
00056
00057 virtual bool isopen();
00058 virtual void outheader();
00059 virtual void close();
00060
00061 virtual void open() {}
00062
00063 protected:
00064 int _version;
00065 int _revision;
00066 int _release;
00067 int _author;
00068 string _descript;
00069
00070 int _arraydim;
00071 int _sbn;
00072
00073 int _mmin_this, _mmax_this;
00074 int _mmin_exist, _mmax_exist;
00075 int _mmin_theory, _mmax_theory;
00076
00077 int _cmin_this, _cmax_this;
00078 int _cmin_exist, _cmax_exist;
00079 int _cmin_theory, _cmax_theory;
00080
00081 int _bplen_mpsizeb;
00082 int _bplen_coef;
00083 int _datatype_code;
00084 int _bplen_n;
00085 int _bplen_a;
00086
00087 ostream* _os;
00088
00089 bool _needheader;
00090
00091 bool _lockfinalstep;
00092 int _finalstep;
00093 };
00094
00095 inline
00096 MCFsbostreamBase::MCFsbostreamBase( const string& descript, ostream& os)
00097 : _version(0), _revision(2), _release(0), _author(0), _descript(descript),
00098 _arraydim(0), _sbn(0),
00099 _mmin_this(0), _mmax_this(31), _mmin_exist(0), _mmax_exist(31),
00100 _mmin_theory(0), _mmax_theory(31),
00101
00102
00103 _cmin_this(-16), _cmax_this(15), _cmin_exist(-16), _cmax_exist(15),
00104 _cmin_theory(-16), _cmax_theory(15),
00105 _bplen_mpsizeb(2), _bplen_coef(8),
00106 _datatype_code(MCF_CODE_UNKNOWN),
00107 _bplen_n(2), _bplen_a(2),
00108 _os(&os),
00109 _needheader(true), _lockfinalstep(false), _finalstep(-1)
00110 {}
00111
00112 inline
00113 MCFsbostreamBase::~MCFsbostreamBase()
00114 {
00115 if ( _os != 0 ) { delete _os; _os = 0; }
00116 }
00117
00118 inline
00119 void MCFsbostreamBase::set_author( const int author) { _author = author; }
00120
00121 inline
00122 void MCFsbostreamBase::set_descript( const string& descript )
00123 {
00124 _descript = descript;
00125 };
00126
00127 inline
00128 void MCFsbostreamBase::set_sbn( const int sbn ) { _sbn = sbn; }
00129
00130 inline
00131 void MCFsbostreamBase::set_mpart(
00132 const int mmin_this, const int mmax_this,
00133 const int mmin_exist, const int mmax_exist,
00134 const int mmin_theory, const int mmax_theory
00135 )
00136 {
00137 _mmin_this = mmin_this;
00138 _mmax_this = mmax_this;
00139 _mmin_exist = mmin_exist;
00140 _mmax_exist = mmax_exist;
00141 _mmin_theory = mmin_theory;
00142 _mmax_theory = mmax_theory;
00143 }
00144
00145 inline
00146 void MCFsbostreamBase::set_cpart(
00147 const int cmin_this, const int cmax_this,
00148 const int cmin_exist, const int cmax_exist,
00149 const int cmin_theory, const int cmax_theory
00150 )
00151 {
00152 _cmin_this = cmin_this;
00153 _cmax_this = cmax_this;
00154 _cmin_exist = cmin_exist;
00155 _cmax_exist = cmax_exist;
00156 _cmin_theory = cmin_theory;
00157 _cmax_theory = cmax_theory;
00158 }
00159
00160 inline
00161 void MCFsbostreamBase::set_bplen(
00162 const int bplen_mpsizeb, const int bplen_coef,
00163 const int bplen_n, const int bplen_a
00164 )
00165 {
00166 _bplen_mpsizeb = bplen_mpsizeb;
00167 _bplen_coef = bplen_coef;
00168 _bplen_n = bplen_n;
00169 _bplen_a = bplen_a;
00170 }
00171
00172 inline
00173 void MCFsbostreamBase::finalstep( const int finalstep )
00174 {
00175 _finalstep = finalstep;
00176 };
00177
00178 inline
00179 int MCFsbostreamBase::finalstep() { return _finalstep; };
00180
00181 inline
00182 bool MCFsbostreamBase::isopen() { return (*_os).good(); }
00183
00184 #endif
00185