00001
00002
00003
00004
00005
00006
00007 #ifndef MRACSPEC_H
00008 #define MRACSPEC_H
00009
00010 #ifdef USE_STD
00011 #include <iostream>
00012 using namespace std;
00013 #else
00014 #include <iostream.h>
00015 #endif
00016
00017 #include "BufferBase.h"
00018 #include "MRAclevel.h"
00019 #include "MRAcrange.h"
00020
00021 class MRAcspec {
00022
00023 public:
00024
00025 MRAcrange cthis, cexist, ctheory;
00026
00027 MRAcspec() {}
00028
00029 MRAcspec( const MRAcspec& );
00030
00031 MRAcspec& operator () ( const MRAcspec& );
00032
00033 MRAcspec& copy( const MRAcspec& );
00034 MRAcspec& operator = ( const MRAcspec& );
00035
00036 bool is_equal( const MRAcspec& );
00037 bool operator == ( const MRAcspec& rhs );
00038 bool operator != ( const MRAcspec& rhs );
00039
00040 int sizeb();
00041
00042 void report( ostream& os = cout );
00043
00044 void write( BufferBase& );
00045 MRAcspec& operator << ( BufferBase& );
00046 void read( BufferBase& );
00047 MRAcspec& operator >> ( BufferBase& );
00048
00049 void write( istream& );
00050 void read( ostream& );
00051
00052 friend BufferBase& operator << ( BufferBase&, MRAcspec& );
00053 friend BufferBase& operator >> ( BufferBase&, MRAcspec& );
00054 friend ostream& operator << ( ostream&, MRAcspec& );
00055 friend istream& operator >> ( istream&, MRAcspec& );
00056
00057 };
00058
00059 inline
00060 MRAcspec::MRAcspec( const MRAcspec& cspec )
00061 : cthis(cspec.cthis), cexist(cspec.cexist), ctheory(cspec.ctheory)
00062 {}
00063
00064 inline
00065 MRAcspec& MRAcspec::operator () ( const MRAcspec& cspec )
00066 {
00067 cthis = cspec.cthis;
00068 cexist = cspec.cexist;
00069 ctheory = cspec.ctheory;
00070 return *this;
00071 }
00072
00073 inline
00074 MRAcspec& MRAcspec::copy( const MRAcspec& cspec )
00075 {
00076 cthis = cspec.cthis;
00077 cexist = cspec.cexist;
00078 ctheory = cspec.ctheory;
00079 return *this;
00080 }
00081
00082 inline
00083 MRAcspec& MRAcspec::operator = ( const MRAcspec& rhs ) { return copy(rhs); }
00084
00085 inline
00086 bool MRAcspec::is_equal( const MRAcspec& cspec )
00087 {
00088 if ( cthis.cmin != cspec.cthis.cmin ) return false;
00089 if ( cthis.cmax != cspec.cthis.cmax ) return false;
00090 if ( cexist.cmin != cspec.cexist.cmin ) return false;
00091 if ( cexist.cmax != cspec.cexist.cmax ) return false;
00092 if ( ctheory.cmin != cspec.ctheory.cmin ) return false;
00093 if ( ctheory.cmax != cspec.ctheory.cmax ) return false;
00094 return true;
00095 }
00096
00097 inline
00098 bool MRAcspec::operator == ( const MRAcspec& rhs ) { return is_equal(rhs); }
00099
00100 inline
00101 bool MRAcspec::operator != ( const MRAcspec& rhs ) { return !is_equal(rhs); }
00102
00103 inline
00104 int MRAcspec::sizeb() { return cthis.sizeb() +cexist.sizeb() +ctheory.sizeb();}
00105
00106 inline
00107 void MRAcspec::report( ostream& os ) {
00108 os << "MRAcspec::report(){\n";
00109 os << "cthis =\n";
00110 cthis.report();
00111 os << "cexist =\n";
00112 cexist.report();
00113 os << "ctheory =\n";
00114 ctheory.report();
00115 os << "}\n";
00116 }
00117
00118 inline
00119 void MRAcspec::write( BufferBase& buffer )
00120 {
00121
00122
00123
00124
00125
00126
00127
00128 buffer >> cthis;
00129 buffer >> cexist;
00130 buffer >> ctheory;
00131 }
00132
00133 inline
00134 MRAcspec& MRAcspec::operator << ( BufferBase& buffer )
00135 {
00136 write(buffer);
00137 return *this;
00138 }
00139
00140 inline
00141 void MRAcspec::read( BufferBase& buffer )
00142 {
00143
00144
00145
00146
00147
00148
00149
00150 buffer << cthis;
00151 buffer << cexist;
00152 buffer << ctheory;
00153 }
00154
00155 inline
00156 MRAcspec& MRAcspec::operator >> ( BufferBase& buffer )
00157 {
00158 read(buffer);
00159 return *this;
00160 }
00161
00162 inline
00163 void MRAcspec::write( istream& is )
00164 {
00165
00166
00167
00168
00169
00170
00171
00172 is >> cthis;
00173 is >> cexist;
00174 is >> ctheory;
00175 }
00176
00177 inline
00178 void MRAcspec::read( ostream& os )
00179 {
00180
00181
00182
00183
00184
00185
00186
00187 os << cthis;
00188 os << cexist;
00189 os << ctheory;
00190 }
00191
00192
00193
00194
00195 inline
00196 BufferBase& operator >> ( BufferBase& buffer, MRAcspec& cspec )
00197 {
00198 cspec.write(buffer);
00199 return buffer;
00200 }
00201
00202 inline
00203 BufferBase& operator << ( BufferBase& buffer, MRAcspec& cspec )
00204 {
00205 cspec.read(buffer);
00206 return buffer;
00207 }
00208
00209 inline
00210 istream& operator >> ( istream& is, MRAcspec& cspec )
00211 {
00212 cspec.write(is);
00213 return is;
00214 }
00215
00216 inline
00217 ostream& operator << ( ostream& os, MRAcspec& cspec )
00218 {
00219 cspec.read(os);
00220 return os;
00221 }
00222
00223 #endif
00224