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

MRAcspec.h

Go to the documentation of this file.
00001 // MRAcspec.h
00002 //////////////////////////////////////////////////////////////////////
00003 //          (c) Copyright 2002 Brown Deer Technology, LLC.
00004 //                        All rights reserved.
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 //   bytepack bp;
00122 //   buffer >> bp( 0, 1 ); cthis.cmin = int(bp);
00123 //   buffer >> bp( 0, 1 ); cthis.cmax = int(bp);
00124 //   buffer >> bp( 0, 1 ); cexist.cmin = int(bp);
00125 //   buffer >> bp( 0, 1 ); cexist.cmax = int(bp);
00126 //   buffer >> bp( 0, 1 ); ctheory.cmin = int(bp);
00127 //   buffer >> bp( 0, 1 ); ctheory.cmax = int(bp);
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 //   bytepack bp;
00144 //   buffer << bp( cthis.cmin, 1 );
00145 //   buffer << bp( cthis.cmin, 1 );
00146 //   buffer << bp( cexist.cmin, 1 );
00147 //   buffer << bp( cexist.cmin, 1 );
00148 //   buffer << bp( ctheory.cmin, 1 );
00149 //   buffer << bp( ctheory.cmin, 1 );
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 //   bytepack bp;
00166 //   is >> bp( 0, 1 ); cthis.cmin = int(bp);
00167 //   is >> bp( 0, 1 ); cthis.cmax = int(bp);
00168 //   is >> bp( 0, 1 ); cexist.cmin = int(bp);
00169 //   is >> bp( 0, 1 ); cexist.cmax = int(bp);
00170 //   is >> bp( 0, 1 ); ctheory.cmin = int(bp);
00171 //   is >> bp( 0, 1 ); ctheory.cmax = int(bp);
00172    is >> cthis;
00173    is >> cexist;
00174    is >> ctheory;
00175 }
00176 
00177 inline
00178 void MRAcspec::read( ostream& os )
00179 {
00180 //   bytepack bp;
00181 //   os << bp( cthis.cmin, 1 );
00182 //   os << bp( cthis.cmin, 1 );
00183 //   os << bp( cexist.cmin, 1 );
00184 //   os << bp( cexist.cmin, 1 );
00185 //   os << bp( ctheory.cmin, 1 );
00186 //   os << bp( ctheory.cmin, 1 );
00187    os << cthis;
00188    os << cexist;
00189    os << ctheory;
00190 }
00191 
00192 
00193 // ##### friends #####
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 

Generated on Mon May 31 21:38:50 2004 for SR2k4 Assembler by doxygen 1.3.6