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

MRAmspec.h

Go to the documentation of this file.
00001 // MRAmspec.h
00002 //////////////////////////////////////////////////////////////////////
00003 //          (c) Copyright 2002 Brown Deer Technology, LLC.
00004 //                        All rights reserved.
00005 //////////////////////////////////////////////////////////////////////
00006 
00007 #ifndef MRAMSPEC_H
00008 #define MRAMSPEC_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 "MRAmlevel.h"
00019 #include "MRAmrange.h"
00020 
00021 class MRAmspec { 
00022 
00023    public: 
00024 
00025       MRAmrange mthis, mexist, mtheory;
00026 
00027       MRAmspec( const MRAmspec& );
00028       MRAmspec( int dim = 0 );
00029       MRAmspec( 
00030         const MRAmrange& mthis, 
00031         const MRAmrange& mexist, 
00032         const MRAmrange& mtheory 
00033       );
00034       
00035       MRAmspec& operator () ( const MRAmspec& );
00036       MRAmspec& operator () ( int dim = 0 );
00037       MRAmspec& operator () ( 
00038         const MRAmrange& mthis, 
00039         const MRAmrange& mexist,
00040         const MRAmrange& mtheory 
00041       );
00042 
00043       MRAmspec& copy( const MRAmspec& );
00044       MRAmspec& operator = ( const MRAmspec& );
00045 
00046       bool is_equal( const MRAmspec& );
00047       bool operator == ( const MRAmspec& rhs );
00048       bool operator != ( const MRAmspec& rhs );
00049 
00050       void set_dim(int);
00051       int dim();
00052 
00053       int sizeb();
00054 
00055       void report( ostream& os = cout );
00056 
00057       void write( BufferBase& );
00058       MRAmspec& operator << ( BufferBase& );
00059       void read( BufferBase& );
00060       MRAmspec& operator >> ( BufferBase& );
00061 
00062       void write( istream& );
00063       void read( ostream& );
00064 
00065    protected:
00066       int _dim;
00067 
00068    friend BufferBase& operator << ( BufferBase&, MRAmspec& );
00069    friend BufferBase& operator >> ( BufferBase&, MRAmspec& );
00070    friend ostream& operator << ( ostream&, MRAmspec& );
00071    friend istream& operator >> ( istream&, MRAmspec& );
00072 
00073 };
00074 
00075 inline
00076 MRAmspec::MRAmspec( const MRAmspec& mspec ) 
00077   : mthis(mspec.mthis), mexist(mspec.mexist), mtheory(mspec.mtheory),
00078     _dim(mspec._dim)
00079 {}
00080 
00081 inline
00082 MRAmspec::MRAmspec( int dim ) 
00083   : mthis(dim), mexist(dim), mtheory(dim), 
00084     _dim(dim)
00085 {}
00086 
00087 inline
00088 MRAmspec::MRAmspec( 
00089   const MRAmrange& mthis0, const MRAmrange& mexist0, const MRAmrange& mtheory0
00090 ) : mthis(mthis0), mexist(mexist0), mtheory(mtheory0)
00091 {
00092    _dim = mthis.dim();
00093 }
00094 
00095 inline
00096 MRAmspec& MRAmspec::copy( const MRAmspec& mspec ) 
00097 {
00098    mthis = mspec.mthis;
00099    mexist = mspec.mexist;
00100    mtheory = mspec.mtheory;
00101    _dim = mspec._dim;
00102    return *this;
00103 }
00104 
00105 inline
00106 MRAmspec& MRAmspec::operator = ( const MRAmspec& rhs ) { return copy(rhs); }
00107 
00108 inline
00109 MRAmspec& MRAmspec::operator () ( const MRAmspec& mspec ) 
00110 { 
00111    mthis = mspec.mthis; 
00112    mexist = mspec.mexist; 
00113    mtheory = mspec.mtheory; 
00114    _dim = mspec._dim;
00115    return *this;
00116 }
00117 
00118 inline
00119 MRAmspec& MRAmspec::operator () ( int dim ) 
00120 { 
00121    mthis(dim); 
00122    mexist(dim); 
00123    mtheory(dim); 
00124    _dim = dim;
00125    return *this; 
00126 }
00127 
00128 inline
00129 MRAmspec& MRAmspec::operator () ( 
00130   const MRAmrange& mthis0, const MRAmrange& mexist0, const MRAmrange& mtheory0
00131 ) 
00132 { 
00133    mthis = mthis0;
00134    mexist = mexist0;
00135    mtheory = mtheory0;
00136    _dim = mthis.dim();
00137    return *this;
00138 }
00139 
00140 inline
00141 bool MRAmspec::is_equal( const MRAmspec& mspec ) 
00142 {
00143    if ( mthis != mspec.mthis ) return false;
00144    if ( mexist != mspec.mexist ) return false;
00145    if ( mtheory != mspec.mtheory ) return false;
00146    if ( _dim != mspec._dim ) return false;
00147    return true;
00148 }
00149 
00150 inline
00151 bool MRAmspec::operator == ( const MRAmspec& rhs ) { return is_equal(rhs); }
00152 
00153 inline
00154 bool MRAmspec::operator != ( const MRAmspec& rhs ) { return !is_equal(rhs); }
00155 
00156 inline
00157 void MRAmspec::set_dim( int dim ) 
00158 { 
00159    mthis(dim);
00160    mexist(dim);
00161    mtheory(dim);
00162    _dim = dim;
00163 }
00164 
00165 inline
00166 int MRAmspec::dim() { return _dim; }
00167 
00168 inline
00169 int MRAmspec::sizeb() { return mthis.sizeb() +mexist.sizeb() +mtheory.sizeb();}
00170 
00171 inline
00172 void MRAmspec::report( ostream& os ) {
00173    os << "MRAmspec::report(){\n";
00174    os << "mthis =\n";
00175    mthis.report();
00176    os << "mexist =\n";
00177    mexist.report();
00178    os << "mtheory =\n";
00179    mtheory.report();
00180    os << "dim = " << _dim << endl;
00181    os << "}\n";
00182 }
00183 
00184 inline
00185 void MRAmspec::write( BufferBase& buffer )
00186 {
00187    buffer >> mthis;
00188    buffer >> mexist;
00189    buffer >> mtheory;
00190 }
00191 
00192 inline
00193 MRAmspec& MRAmspec::operator << ( BufferBase& buffer )
00194 {
00195    write(buffer);
00196    return *this;
00197 }
00198 
00199 inline
00200 void MRAmspec::read( BufferBase& buffer )
00201 {
00202    buffer << mthis;
00203    buffer << mexist;
00204    buffer << mtheory;
00205 }
00206 
00207 inline
00208 MRAmspec& MRAmspec::operator >> ( BufferBase& buffer )
00209 {
00210    read(buffer);
00211    return *this;
00212 }
00213 
00214 inline
00215 void MRAmspec::write( istream& is )
00216 {
00217    is >> mthis;
00218    is >> mexist;
00219    is >> mtheory;
00220 }
00221 
00222 inline
00223 void MRAmspec::read( ostream& os )
00224 {
00225    os << mthis;
00226    os << mexist;
00227    os << mtheory;
00228 }
00229 
00230 
00231 // ##### friends #####
00232 
00233 inline
00234 BufferBase& operator >> ( BufferBase& buffer, MRAmspec& mspec )
00235 {
00236    mspec.write(buffer);
00237    return buffer;
00238 }
00239 
00240 inline
00241 BufferBase& operator << ( BufferBase& buffer, MRAmspec& mspec )
00242 {
00243    mspec.read(buffer);
00244    return buffer;
00245 }
00246 
00247 inline
00248 istream& operator >> ( istream& is, MRAmspec& mspec )
00249 {
00250    mspec.write(is);
00251    return is;
00252 }
00253 
00254 inline
00255 ostream& operator << ( ostream& os, MRAmspec& mspec )
00256 {
00257    mspec.read(os);
00258    return os;
00259 }
00260 
00261 #endif
00262 

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