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

MRAmpBase Class Reference

#include <MRAmpBase.h>

Inheritance diagram for MRAmpBase:

Inheritance graph
[legend]
Collaboration diagram for MRAmpBase:

Collaboration graph
[legend]

Public Member Functions

int acoefsizeb ()
void append (const int *a, bytepack bpcoef)
void append (int a, bytepack bpcoef)
bool baddim ()
iterator begin ()
void clear ()
void clrstate (int)
virtual MRAmpBasecopy (const MRAmpBase &)
iterator end ()
bool fail ()
void fix_hdr ()
void fix_mp ()
bool good ()
bool hdrfixed ()
int hdrsizeb ()
bool is_empty ()
bool is_equal (const MRAmpBase &)
bool is_null ()
virtual string isa () const
int mcode (int d=0)
int mcode_to_m (int=0)
int mcode_to_order (int=0)
int mcode_to_rs (int=0)
int mcode_to_sw (int=0)
MRAmpEncodempenc ()
bool mpfixed ()
int mpsizeb ()
 MRAmpBase (const MRAmpEncode &, BufferBase *)
 MRAmpBase (const MRAmpBase &, BufferBase *)
 MRAmpBase (BufferBase *)
int n (int d=0)
int nullsizeb ()
bool operator! ()
bool operator!= (const MRAmpBase &)
MRAmpBaseoperator() (const MRAmpEncode &mpenc)
MRAmpBaseoperator() (const MRAmpBase &rhs)
MRAmpBaseoperator() ()
MRAmpBaseoperator<< (BufferBase &)
virtual MRAmpBaseoperator= (const MRAmpBase &)
bool operator== (const MRAmpBase &)
MRAmpBaseoperator>> (BufferBase &)
int rdstate (int=0xFF)
void read (ostream &)
void read (BufferBase &)
void refix_hdr ()
void report (ostream &=cout)
MRAmpBaseset_empty ()
void set_mcode (int d, char mcode)
void set_mcode (const char *mcode)
void set_n (int d, int n)
void set_n (const int *n)
MRAmpBaseset_null ()
void setstate (int)
void unfix_mp ()
void write (istream &)
void write (BufferBase &)
virtual ~MRAmpBase ()

Static Public Attributes

const int baddimbit = 0x04
const int failbit = 0x02
const int goodbit = 0x01
const int hdrfixedbit = 0x10
const int mpfixedbit = 0x20

Protected Attributes

char _mcode [MRA_MAXDIM]
MRAmpEncode _mpenc
int _mpsizeb
int _n [MRA_MAXDIM]
BufferBase_ptbuffer
int _state

Private Member Functions

 MRAmpBase ()
virtual void synchronize ()

Friends

class MRAmpBuilder
ostream & operator<< (ostream &, MRAmpBase &)
BufferBaseoperator<< (BufferBase &, MRAmpBase &)
istream & operator>> (istream &, MRAmpBase &)
BufferBaseoperator>> (BufferBase &, MRAmpBase &)

Constructor & Destructor Documentation

MRAmpBase::MRAmpBase BufferBase  ) 
 

Definition at line 194 of file MRAmpBase.h.

References set_null().

00195   : _state(0), 
00196     _ptbuffer(ptbuffer) 
00197 { 
00198    set_null(); 
00199 }

MRAmpBase::MRAmpBase const MRAmpBase ,
BufferBase
 

Definition at line 202 of file MRAmpBase.h.

References _mcode, _mpenc, _n, and MRAmpEncode.grid_dim().

00203   : _state(mp._state), 
00204     _mpenc(mp._mpenc), _mpsizeb(mp._mpsizeb), _ptbuffer(ptbuffer)
00205 {
00206    for( int d = 0; d < _mpenc.grid_dim(); ++d ) {
00207       _mcode[d] = mp._mcode[d];
00208       _n[d] = mp._n[d];
00209    }
00210 }

MRAmpBase::MRAmpBase const MRAmpEncode ,
BufferBase
 

Definition at line 213 of file MRAmpBase.h.

References _mpenc, and MRAmpEncode.grid_dim().

00214   : _state(goodbit),
00215     _mpenc(mpenc), _mpsizeb(0), _ptbuffer(ptbuffer)
00216 {
00217    for( int d = 0; d < _mpenc.grid_dim(); ++d ) {
00218       _mcode[d] = 0;
00219       _n[d] = 0;
00220    }
00221 }

MRAmpBase::~MRAmpBase  )  [virtual]
 

Definition at line 224 of file MRAmpBase.h.

References _ptbuffer.

00225 {
00226    if ( _ptbuffer != 0 ) { delete _ptbuffer; _ptbuffer = 0; }
00227 }

MRAmpBase.MRAmpBase  )  [private]
 

Definition at line 176 of file MRAmpBase.h.

00176 {}


Member Function Documentation

int MRAmpBase::acoefsizeb  ) 
 

Definition at line 576 of file MRAmpBase.h.

References _mpenc, MRAmpEncode.bplen_a(), MRAmpEncode.bplen_coef(), and MRAmpEncode.grid_dim().

Referenced by MRAsbObject.cstattable_sbsizeb().

00577 {
00578    int tmp =  _mpenc.bplen_coef();
00579    for( int d = 0; d < _mpenc.grid_dim(); ++d ) { tmp += _mpenc.bplen_a(d); }
00580    return tmp;
00581 }

void MRAmpBase::append const int a,
bytepack  bpcoef
 

Definition at line 442 of file MRAmpBase.h.

References _mpenc, _ptbuffer, MRAmpEncode.array_dim(), MRAmpEncode.bplen_a(), MRAmpEncode.bplen_coef(), hdrfixed(), mpfixed(), setstate(), and BufferBase.write().

00443 {
00444    if ( hdrfixed() && !mpfixed() ) {
00445       bytepack bp;
00446       for( int d = 0; d < _mpenc.array_dim(); ++d ) {
00447          _ptbuffer->write( bp( a[d], _mpenc.bplen_a(d) ) );
00448          _mpsizeb += _mpenc.bplen_a(d);
00449       }
00450 //      _ptbuffer->write( bp( coef, _mpenc.bplen_coef() ) );
00451       _ptbuffer->write( bpcoef );
00452       _mpsizeb += _mpenc.bplen_coef();
00453    } else setstate(failbit);
00454 }

void MRAmpBase::append int  a,
bytepack  bpcoef
 

Definition at line 428 of file MRAmpBase.h.

References _mpenc, _ptbuffer, MRAmpEncode.bplen_a(), MRAmpEncode.bplen_coef(), hdrfixed(), mpfixed(), setstate(), and BufferBase.write().

Referenced by MRAsbBase.append(), and MRAsbBase.copy().

00429 {
00430    if ( hdrfixed() && !mpfixed() ) {
00431       bytepack bp;
00432       _ptbuffer->write( bp( a, _mpenc.bplen_a(0) ) );
00433       _mpsizeb += _mpenc.bplen_a(0);
00434       _ptbuffer->write( bpcoef );
00435 cout << "append " << float(bpcoef) << endl;
00436       _mpsizeb += _mpenc.bplen_coef();
00437    } else setstate(failbit);
00438 }

bool MRAmpBase::baddim  ) 
 

Definition at line 324 of file MRAmpBase.h.

References baddimbit, and rdstate().

00324 { return rdstate(baddimbit) != 0; }

MRAmpBase::iterator MRAmpBase::begin  ) 
 

Definition at line 661 of file MRAmpBase.h.

References MRAmpBase.iterator._pos, and hdrsizeb().

Referenced by MRAsbObject.cstattable_sbsizeb().

00662 {
00663    iterator iter(this);
00664 //   if ( hdrfixed() && sbfixed() ) {
00665       iter._pos = hdrsizeb();
00666 //   } else {
00667 //      iter.set_null();
00668 //   }
00669    return iter;
00670 }

void MRAmpBase::clear  ) 
 

Definition at line 306 of file MRAmpBase.h.

Referenced by operator()(), and set_empty().

00306 { _state = goodbit; }

void MRAmpBase::clrstate int   ) 
 

Definition at line 312 of file MRAmpBase.h.

Referenced by unfix_mp().

00312 { _state &= ~s; }

MRAmpBase & MRAmpBase::copy const MRAmpBase  )  [virtual]
 

Definition at line 230 of file MRAmpBase.h.

References _mcode, _mpenc, _mpsizeb, _n, _ptbuffer, _state, BufferBase.erase(), BufferBase.get(), MRAmpEncode.grid_dim(), BufferBase.put(), and BufferBase.seekg().

Referenced by MRAmp.copy(), operator()(), and operator=().

00231 {
00232    if ( this != &mp ) {
00233       _state = mp._state;
00234       _mpenc = mp._mpenc;
00235       _mpsizeb = mp._mpsizeb;
00236       for( int d = 0; d < _mpenc.grid_dim(); ++d ) {
00237          _mcode[d] = mp._mcode[d];
00238          _n[d] = mp._n[d];
00239       }
00240       mp._ptbuffer->seekg(0);
00241       _ptbuffer->erase();
00242       for( int i = 0; i < mp._mpsizeb; ++i ) {
00243          _ptbuffer->put( mp._ptbuffer->get() );
00244       }
00245    }
00246    return *this;
00247 }

MRAmpBase::iterator MRAmpBase::end  ) 
 

Definition at line 673 of file MRAmpBase.h.

References _mpenc, MRAmpBase.iterator._pos, MRAmpEncode.bplen_mpsizeb(), and mpsizeb().

Referenced by MRAsbObject.cstattable_sbsizeb().

00674 {
00675    iterator iter(this);
00676 //   if ( hdrfixed() && sbfixed() ) {
00677 //      iter._pos = _sbsizeb - 4 - _mpenc.bplen_mpsizeb() * 2;
00678 //      iter._pos = mpsizeb();
00679       iter._pos = mpsizeb() - _mpenc.bplen_mpsizeb();
00680 //   }  else {
00681 //      iter.set_null();
00682 //   }
00683    return iter;
00684 }

bool MRAmpBase::fail  ) 
 

Definition at line 321 of file MRAmpBase.h.

References rdstate().

00321 { return rdstate(failbit) != 0; }

void MRAmpBase::fix_hdr  ) 
 

Definition at line 392 of file MRAmpBase.h.

References _mpenc, _ptbuffer, MRAmpEncode.bplen_mpsizeb(), MRAmpEncode.bplen_n(), MRAmpEncode.grid_dim(), hdrfixed(), hdrfixedbit, hdrsizeb(), mpfixed(), BufferBase.seekp(), setstate(), and BufferBase.write().

Referenced by MRAsbBase.append(), and MRAsbBase.copy().

00392                         { 
00393    if ( !hdrfixed() && !mpfixed() ) {
00394       bytepack bp;
00395       setstate(hdrfixedbit);
00396       _mpsizeb = hdrsizeb();
00397       _ptbuffer->seekp(0);
00398       _ptbuffer->write( bp( _mpsizeb, _mpenc.bplen_mpsizeb() ) );
00399       for( int d = 0; d < _mpenc.grid_dim(); ++d ) {
00400          _ptbuffer->write( bp( _mcode[d], 1 ) );
00401       }
00402       for( int d = 0; d < _mpenc.grid_dim(); ++d ) {
00403          _ptbuffer->write( bp( _n[d], _mpenc.bplen_n(d) ) );
00404       }
00405    } else setstate(failbit);
00406 }

void MRAmpBase::fix_mp  ) 
 

Definition at line 457 of file MRAmpBase.h.

References _mpenc, _ptbuffer, MRAmpEncode.bplen_mpsizeb(), hdrfixed(), mpfixed(), mpfixedbit, BufferBase.seekp(), setstate(), and BufferBase.write().

Referenced by MRAsbBase.append(), and MRAsbBase.copy().

00458 {
00459    if ( hdrfixed() && !mpfixed() ) {
00460       bytepack bp;
00461       setstate(mpfixedbit);
00462       _mpsizeb += _mpenc.bplen_mpsizeb();
00463       _ptbuffer->write( bp( _mpsizeb, _mpenc.bplen_mpsizeb() ));
00464       _ptbuffer->seekp(0);
00465       _ptbuffer->write( bp( _mpsizeb, _mpenc.bplen_mpsizeb() ));
00466       _ptbuffer->seekp(0,BufferBase::end);
00467    } else setstate(failbit);
00468 }

bool MRAmpBase::good  ) 
 

Definition at line 318 of file MRAmpBase.h.

References rdstate().

00318 { return rdstate(goodbit) != 0; }

bool MRAmpBase::hdrfixed  ) 
 

Definition at line 327 of file MRAmpBase.h.

References hdrfixedbit, and rdstate().

Referenced by append(), fix_hdr(), fix_mp(), refix_hdr(), set_mcode(), set_n(), and unfix_mp().

00327 { return rdstate(hdrfixedbit) != 0; }

int MRAmpBase::hdrsizeb  ) 
 

Definition at line 568 of file MRAmpBase.h.

References _mpenc, MRAmpEncode.bplen_mpsizeb(), MRAmpEncode.bplen_n(), and MRAmpEncode.grid_dim().

Referenced by begin(), MRAsbObject.cstattable_sbsizeb(), fix_hdr(), is_empty(), and set_empty().

00569 {
00570    int tmp =  _mpenc.bplen_mpsizeb() + _mpenc.grid_dim();
00571    for( int d = 0; d < _mpenc.grid_dim(); ++d ) { tmp += _mpenc.bplen_n(d); }
00572    return tmp;
00573 }

bool MRAmpBase::is_empty  ) 
 

Definition at line 356 of file MRAmpBase.h.

References _mpenc, MRAmpEncode.bplen_mpsizeb(), and hdrsizeb().

00357 { 
00358    return _mpsizeb <= hdrsizeb() + _mpenc.bplen_mpsizeb(); 
00359 }

bool MRAmpBase::is_equal const MRAmpBase  ) 
 

Definition at line 276 of file MRAmpBase.h.

References _mcode, _mpenc, _mpsizeb, _n, _ptbuffer, _state, BufferBase.get(), MRAmpEncode.grid_dim(), BufferBase.seekg(), and BufferBase.tellg().

Referenced by operator!=(), and operator==().

00277 {
00278    if ( this != &mp ) {
00279       if ( _state != mp._state ) return false;
00280       if ( _mpenc != mp._mpenc ) return false;
00281       if ( _mpsizeb != mp._mpsizeb ) return false;
00282       for( int d = 0; d < _mpenc.grid_dim(); ++d ) {
00283          if ( _mcode[d] != mp._mcode[d] ) return false;
00284          if ( _n[d] != mp._n[d] ) return false;
00285       }
00286       int mark = _ptbuffer->tellg();
00287       int mpmark = mp._ptbuffer->tellg();
00288       _ptbuffer->seekg(0);
00289       mp._ptbuffer->seekg(0);
00290       for( int i = 0; i < _mpsizeb; ++i ) {
00291          if ( _ptbuffer->get() != mp._ptbuffer->get() ) return false;
00292       }
00293       _ptbuffer->seekg(mark);
00294       mp._ptbuffer->seekg(mpmark);
00295    }
00296    return true;
00297 }

bool MRAmpBase::is_null  ) 
 

Definition at line 341 of file MRAmpBase.h.

Referenced by operator!(), and read().

00341 { return _mpsizeb == 0; }

virtual string MRAmpBase.isa  )  const [virtual]
 

Definition at line 49 of file MRAmpBase.h.

00049 { return "MRAmpBase"; }

int MRAmpBase::mcode int  d = 0  ) 
 

Definition at line 590 of file MRAmpBase.h.

00590 { return _mcode[d]; }

int MRAmpBase::mcode_to_m int  = 0  ) 
 

Definition at line 599 of file MRAmpBase.h.

References mcode_to_m().

Referenced by MRAsbBase.append(), MRAsbBase.copy(), MRAsbBase.mmatch(), and MRAsbObject.mstattable_sbsizeb().

00600 { 
00601    return ::mcode_to_m( _mcode[d] ); 
00602 }

int MRAmpBase::mcode_to_order int  = 0  ) 
 

Definition at line 617 of file MRAmpBase.h.

References mcode_to_order().

00618 { 
00619    return ::mcode_to_order( _mcode[d] ); 
00620 }

int MRAmpBase::mcode_to_rs int  = 0  ) 
 

Definition at line 611 of file MRAmpBase.h.

References mcode_to_rs().

00612 { 
00613    return ::mcode_to_rs( _mcode[d] ); 
00614 }

int MRAmpBase::mcode_to_sw int  = 0  ) 
 

Definition at line 605 of file MRAmpBase.h.

References mcode_to_sw().

00606 { 
00607    return ::mcode_to_sw( _mcode[d] ); 
00608 }

MRAmpEncode & MRAmpBase::mpenc  ) 
 

Definition at line 584 of file MRAmpBase.h.

References _mpenc.

Referenced by MRAsbBase.append(), and MRAsbObject.cstattable_sbsizeb().

00584 { return _mpenc; }

bool MRAmpBase::mpfixed  ) 
 

Definition at line 330 of file MRAmpBase.h.

References mpfixedbit, and rdstate().

Referenced by append(), fix_hdr(), fix_mp(), refix_hdr(), set_mcode(), set_n(), and unfix_mp().

00330 { return rdstate(mpfixedbit) != 0; }

int MRAmpBase::mpsizeb  ) 
 

Definition at line 587 of file MRAmpBase.h.

Referenced by MRAsbBase.append(), end(), and MRAsbObject.mstattable_sbsizeb().

00587 { return _mpsizeb; }

int MRAmpBase::n int  d = 0  ) 
 

Definition at line 593 of file MRAmpBase.h.

00593 { return _n[d]; }

int MRAmpBase::nullsizeb  ) 
 

Definition at line 596 of file MRAmpBase.h.

References _mpenc, and MRAmpEncode.bplen_mpsizeb().

Referenced by MRAsbBase.append_null(), and MRAsbBase.unfix_sb().

00596 { return 2 * _mpenc.bplen_mpsizeb(); }

bool MRAmpBase::operator!  ) 
 

Definition at line 344 of file MRAmpBase.h.

References is_null().

00344 { return is_null(); }

bool MRAmpBase::operator!= const MRAmpBase  ) 
 

Definition at line 303 of file MRAmpBase.h.

References is_equal().

00303 { return !is_equal(rhs); }

MRAmpBase & MRAmpBase::operator() const MRAmpEncode mpenc  ) 
 

Definition at line 262 of file MRAmpBase.h.

References _mpenc, _ptbuffer, clear(), BufferBase.erase(), and MRAmpEncode.grid_dim().

00263 {
00264    clear();
00265    _mpenc = mpenc;
00266    _mpsizeb = 0;
00267    for( int d = 0; d < _mpenc.grid_dim(); ++d ) {
00268       _mcode[d] = 0;
00269       _n[d] = 0;
00270    }
00271    _ptbuffer->erase();
00272    return *this;
00273 }

MRAmpBase & MRAmpBase::operator() const MRAmpBase rhs  ) 
 

Definition at line 256 of file MRAmpBase.h.

References copy().

00257 { 
00258    return copy(mp); 
00259 }

MRAmpBase & MRAmpBase::operator()  ) 
 

Definition at line 253 of file MRAmpBase.h.

References set_null().

00253 { return set_null(); }

MRAmpBase & MRAmpBase::operator<< BufferBase  ) 
 

Definition at line 504 of file MRAmpBase.h.

References write().

00505 {
00506    write(buffer);
00507    return *this;
00508 }

MRAmpBase & MRAmpBase::operator= const MRAmpBase  )  [virtual]
 

Definition at line 250 of file MRAmpBase.h.

References copy().

00250 { return copy(rhs); }

bool MRAmpBase::operator== const MRAmpBase  ) 
 

Definition at line 300 of file MRAmpBase.h.

References is_equal().

00300 { return is_equal(rhs); }

MRAmpBase & MRAmpBase::operator>> BufferBase  ) 
 

Definition at line 527 of file MRAmpBase.h.

References read().

00528 {
00529    read(buffer);
00530    return *this;
00531 }

int MRAmpBase::rdstate int  = 0xFF  ) 
 

Definition at line 315 of file MRAmpBase.h.

Referenced by baddim(), fail(), good(), hdrfixed(), and mpfixed().

00315 { return (_state & s); }

void MRAmpBase::read ostream &   ) 
 

Definition at line 552 of file MRAmpBase.h.

References _mpenc, _ptbuffer, MRAmpEncode.bplen_mpsizeb(), BufferBase.get(), is_null(), and BufferBase.seekg().

00553 {
00554    if ( !is_null() ) {
00555       _ptbuffer->seekg(0);
00556       for( int i = 0; i < _mpsizeb; ++i ) {
00557          os.put( _ptbuffer->get() );
00558       }
00559    }
00560    else { 
00561        bytepack bp;
00562        os << bp( 0, _mpenc.bplen_mpsizeb() );
00563        os << bp( 0, _mpenc.bplen_mpsizeb() );
00564    }
00565 }

void MRAmpBase::read BufferBase  ) 
 

Definition at line 511 of file MRAmpBase.h.

References _mpenc, _ptbuffer, MRAmpEncode.bplen_mpsizeb(), BufferBase.get(), is_null(), BufferBase.put(), and BufferBase.seekg().

Referenced by MRAsbBase.append(), MRAsbBase.append_null(), operator<<(), and operator>>().

00512 {
00513    if ( !is_null() ) {
00514       _ptbuffer->seekg(0);
00515       for( int i = 0; i < _mpsizeb; ++i ) {
00516          buffer.put( _ptbuffer->get() );
00517       }
00518    }
00519    else { 
00520        bytepack bp;
00521        buffer << bp( 0, _mpenc.bplen_mpsizeb() );
00522        buffer << bp( 0, _mpenc.bplen_mpsizeb() );
00523    }
00524 }

void MRAmpBase::refix_hdr  ) 
 

Definition at line 409 of file MRAmpBase.h.

References _mpenc, _ptbuffer, MRAmpEncode.bplen_mpsizeb(), MRAmpEncode.bplen_n(), MRAmpEncode.grid_dim(), hdrfixed(), hdrfixedbit, mpfixed(), BufferBase.seekp(), setstate(), and BufferBase.write().

00409                           { 
00410    if ( hdrfixed() && !mpfixed() ) {
00411       bytepack bp;
00412       setstate(hdrfixedbit);
00413 //      _mpsizeb = hdrsizeb();
00414       _ptbuffer->seekp(0);
00415       _ptbuffer->write( bp( _mpsizeb, _mpenc.bplen_mpsizeb() ) );
00416       for( int d = 0; d < _mpenc.grid_dim(); ++d ) {
00417          _ptbuffer->write( bp( _mcode[d], 1 ) );
00418       }
00419       for( int d = 0; d < _mpenc.grid_dim(); ++d ) {
00420          _ptbuffer->write( bp( _n[d], _mpenc.bplen_n(d) ) );
00421       }
00422       _ptbuffer->seekp(_mpsizeb);
00423    } else setstate(failbit);
00424 }

void MRAmpBase::report ostream &  = cout  ) 
 

Definition at line 623 of file MRAmpBase.h.

References _mpenc, MRAmpEncode.grid_dim(), and MRAmpEncode.report().

00624 {
00625    os << "MRAmpBase::report mpenc:\n";
00626    _mpenc.report(os);
00627    os << "MRAmpBase::report mpsizeb =" << _mpsizeb << '\n';
00628    for( int d = 0; d < _mpenc.grid_dim(); ++d ) {
00629       os << "MRAmpBase::report int(mcode[" << d << "])=" 
00630          << int(_mcode[d]) << '\n';
00631    }
00632    for( int d = 0; d < _mpenc.grid_dim(); ++d ) {
00633       os << "MRAmpBase::report n[" << d << "]=" 
00634          << _n[d] << '\n';
00635    }
00636 }

MRAmpBase & MRAmpBase::set_empty  ) 
 

Definition at line 347 of file MRAmpBase.h.

References _mpenc, _ptbuffer, MRAmpEncode.bplen_mpsizeb(), clear(), BufferBase.erase(), and hdrsizeb().

Referenced by MRAsbBase.append(), and MRAsbBase.copy().

00348 {
00349    clear(); 
00350    _mpsizeb = hdrsizeb() + _mpenc.bplen_mpsizeb(); 
00351    _ptbuffer->erase();
00352    return *this;
00353 }

void MRAmpBase::set_mcode int  d,
char  mcode
 

Definition at line 370 of file MRAmpBase.h.

References hdrfixed(), mpfixed(), and setstate().

00371 {
00372    if ( !hdrfixed() && !mpfixed() ) _mcode[d] = mcode;
00373    else setstate(failbit);
00374 }

void MRAmpBase::set_mcode const char *  mcode  ) 
 

Definition at line 362 of file MRAmpBase.h.

References _mpenc, MRAmpEncode.grid_dim(), hdrfixed(), mpfixed(), and setstate().

00363 {
00364    if ( !hdrfixed() && !mpfixed() ) {
00365       for( int d = 0; d < _mpenc.grid_dim(); ++d ) _mcode[d] = mcode[d];
00366    } else setstate(failbit);
00367 }

void MRAmpBase::set_n int  d,
int  n
 

Definition at line 385 of file MRAmpBase.h.

References hdrfixed(), mpfixed(), and setstate().

00386 { 
00387    if ( !hdrfixed() && !mpfixed() ) _n[d] = n; 
00388    else setstate(failbit);
00389 }

void MRAmpBase::set_n const int n  ) 
 

Definition at line 377 of file MRAmpBase.h.

References _mpenc, MRAmpEncode.grid_dim(), hdrfixed(), mpfixed(), and setstate().

00378 {
00379    if ( !hdrfixed() && !mpfixed() ) {
00380       for( int d = 0; d < _mpenc.grid_dim(); ++d ) _n[d] = n[d];
00381    } else setstate(failbit);
00382 }

MRAmpBase & MRAmpBase::set_null  ) 
 

Definition at line 333 of file MRAmpBase.h.

References _ptbuffer, and BufferBase.erase().

Referenced by MRAsbBase.append_null(), MRAmpBase(), and operator()().

00334 { 
00335    _mpsizeb = 0;
00336    _ptbuffer->erase();
00337    return *this;
00338 }

void MRAmpBase::setstate int   ) 
 

Definition at line 309 of file MRAmpBase.h.

Referenced by append(), fix_hdr(), fix_mp(), refix_hdr(), set_mcode(), set_n(), and unfix_mp().

00309 { _state |= s; }

void MRAmpBase::synchronize  )  [private, virtual]
 

Definition at line 639 of file MRAmpBase.h.

References _mpenc, _ptbuffer, MRAmpEncode.bplen_mpsizeb(), MRAmpEncode.bplen_n(), MRAmpEncode.grid_dim(), BufferBase.read(), and BufferBase.seekg().

Referenced by write().

00640 {
00641    bytepack bp;
00642    _ptbuffer->seekg(0);
00643    _ptbuffer->read( bp( 0, _mpenc.bplen_mpsizeb() ) ); _mpsizeb = int(bp);
00644    if ( _mpsizeb != 0 ) {
00645       for( int d = 0; d < _mpenc.grid_dim(); ++d ) {
00646          _ptbuffer->read( bp(0,1) ); _mcode[d] = char(bp);
00647       }
00648       for( int d = 0; d < _mpenc.grid_dim(); ++d ) {
00649          _ptbuffer->read( bp( 0, _mpenc.bplen_n(d) ) ); _n[d] = int(bp);
00650       }
00651    }
00652    else { 
00653       for( int d = 0; d < _mpenc.grid_dim(); ++d ) {
00654          _mcode[d] = 0;
00655          _n[d] = 0;
00656       }
00657    }
00658 }

void MRAmpBase::unfix_mp  ) 
 

Definition at line 471 of file MRAmpBase.h.

References _mpenc, _ptbuffer, MRAmpEncode.bplen_mpsizeb(), clrstate(), hdrfixed(), mpfixed(), mpfixedbit, BufferBase.seekp(), setstate(), and BufferBase.write().

00472 {
00473    if ( hdrfixed() && mpfixed() ) {
00474       bytepack bp;
00475       clrstate(mpfixedbit);
00476       _mpsizeb -= _mpenc.bplen_mpsizeb();
00477 //      _ptbuffer->write( bp( _mpsizeb, _mpenc.bplen_mpsizeb() ));
00478       _ptbuffer->seekp(0);
00479       _ptbuffer->write( bp( _mpsizeb, _mpenc.bplen_mpsizeb() ));
00480 //      _ptbuffer->seekp(0,BufferBase::end);
00481       _ptbuffer->seekp(_mpsizeb);
00482    } else setstate(failbit);
00483 }

void MRAmpBase::write istream &   ) 
 

Definition at line 534 of file MRAmpBase.h.

References _mpenc, _ptbuffer, MRAmpEncode.bplen_mpsizeb(), BufferBase.erase(), BufferBase.put(), synchronize(), and BufferBase.write().

00535 {
00536    bytepack bp;
00537    _ptbuffer->erase();
00538    is >> bp( 0, _mpenc.bplen_mpsizeb() ); _mpsizeb = int(bp);
00539    _ptbuffer->write(bp);
00540    if ( _mpsizeb != 0 ) {
00541       for(int i = _mpenc.bplen_mpsizeb(); i < _mpsizeb; ++i) {
00542          _ptbuffer->put( is.get() );
00543       }
00544    }
00545    else { 
00546       _ptbuffer->write(bp);
00547    }
00548    synchronize();
00549 }

void MRAmpBase::write BufferBase  ) 
 

Definition at line 486 of file MRAmpBase.h.

References _mpenc, _ptbuffer, MRAmpEncode.bplen_mpsizeb(), BufferBase.erase(), BufferBase.get(), BufferBase.put(), synchronize(), and BufferBase.write().

Referenced by MRAsbBase.iterator.operator *(), MRAsbBase.iterator.operator++(), operator<<(), and operator>>().

00487 {
00488    bytepack bp;
00489    _ptbuffer->erase();
00490    buffer >> bp( 0, _mpenc.bplen_mpsizeb() ); _mpsizeb = int(bp); 
00491    _ptbuffer->write(bp);
00492    if ( _mpsizeb != 0 ) {
00493       for(int i = _mpenc.bplen_mpsizeb(); i < _mpsizeb; ++i) {
00494          _ptbuffer->put( buffer.get() );
00495       }
00496    }
00497    else { 
00498       _ptbuffer->write(bp);
00499    }
00500    synchronize();
00501 }


Friends And Related Function Documentation

friend class MRAmpBuilder [friend]
 

Definition at line 187 of file MRAmpBase.h.

ostream& operator<< ostream &  os,
MRAmpBase mp
[friend]
 

Definition at line 812 of file MRAmpBase.h.

00813 {
00814    mp.read(os);
00815    return os;
00816 }

BufferBase& operator<< BufferBase buffer,
MRAmpBase mp
[friend]
 

Definition at line 798 of file MRAmpBase.h.

00799 {
00800    mp.read(buffer);
00801    return buffer;
00802 }

istream& operator>> istream &  is,
MRAmpBase mp
[friend]
 

Definition at line 819 of file MRAmpBase.h.

00820 {
00821    mp.write(is);
00822    return is;
00823 }

BufferBase& operator>> BufferBase buffer,
MRAmpBase mp
[friend]
 

Definition at line 805 of file MRAmpBase.h.

00806 {
00807    mp.write(buffer);
00808    return buffer;
00809 }


Field Documentation

char MRAmpBase._mcode[MRA_MAXDIM] [protected]
 

Definition at line 170 of file MRAmpBase.h.

Referenced by copy(), is_equal(), and MRAmpBase().

MRAmpEncode MRAmpBase._mpenc [protected]
 

Definition at line 166 of file MRAmpBase.h.

Referenced by acoefsizeb(), append(), copy(), end(), fix_hdr(), fix_mp(), hdrsizeb(), is_empty(), is_equal(), mpenc(), MRAmpBase(), nullsizeb(), MRAmpBase.iterator.operator *(), operator()(), MRAmpBase.iterator.operator++(), read(), refix_hdr(), report(), set_empty(), set_mcode(), set_n(), synchronize(), unfix_mp(), and write().

int MRAmpBase._mpsizeb [protected]
 

Definition at line 168 of file MRAmpBase.h.

Referenced by copy(), and is_equal().

int MRAmpBase._n[MRA_MAXDIM] [protected]
 

Definition at line 171 of file MRAmpBase.h.

Referenced by copy(), is_equal(), and MRAmpBase().

BufferBase* MRAmpBase._ptbuffer [protected]
 

Definition at line 173 of file MRAmpBase.h.

Referenced by append(), copy(), MRAmp.copy(), fix_hdr(), fix_mp(), is_equal(), MRAmpBase.iterator.operator *(), operator()(), MRAmpBase.iterator.operator++(), read(), refix_hdr(), set_empty(), set_null(), synchronize(), unfix_mp(), write(), and ~MRAmpBase().

int MRAmpBase._state [protected]
 

Definition at line 164 of file MRAmpBase.h.

Referenced by copy(), and is_equal().

const int MRAmpBase.baddimbit = 0x04 [static]
 

Definition at line 53 of file MRAmpBase.h.

Referenced by baddim().

const int MRAmpBase.failbit = 0x02 [static]
 

Definition at line 52 of file MRAmpBase.h.

const int MRAmpBase.goodbit = 0x01 [static]
 

Definition at line 51 of file MRAmpBase.h.

const int MRAmpBase.hdrfixedbit = 0x10 [static]
 

Definition at line 55 of file MRAmpBase.h.

Referenced by fix_hdr(), hdrfixed(), and refix_hdr().

const int MRAmpBase.mpfixedbit = 0x20 [static]
 

Definition at line 56 of file MRAmpBase.h.

Referenced by fix_mp(), mpfixed(), and unfix_mp().


The documentation for this class was generated from the following file:
Generated on Mon May 31 21:41:27 2004 for SR2k4 Assembler by doxygen 1.3.6