Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions
morkWeeAnonAtom Class Reference

#include <morkAtom.h>

Inheritance diagram for morkWeeAnonAtom:
Inheritance graph
[legend]
Collaboration diagram for morkWeeAnonAtom:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 morkWeeAnonAtom ()
void InitWeeAnonAtom (morkEnv *ev, const morkBuf &inBuf)
mork_bool IsWeeAnon () const
mork_bool IsBigAnon () const
mork_bool IsWeeBook () const
mork_bool IsBigBook () const
mork_bool IsFarBook () const
mork_bool IsRowOid () const
mork_bool IsTableOid () const
mork_bool IsBook () const
void SetAtomClean ()
void SetAtomDirty ()
mork_bool IsAtomClean () const
mork_bool IsAtomDirty () const
mork_scope GetBookAtomSpaceScope (morkEnv *ev) const
mork_aid GetBookAtomAid () const
void MakeCellUseForever (morkEnv *ev)
mork_u1 AddCellUse (morkEnv *ev)
mork_u1 CutCellUse (morkEnv *ev)
mork_bool IsCellUseForever () const
mork_bool AsBuf (morkBuf &outBuf) const
mork_bool AliasYarn (mdbYarn *outYarn) const
mork_bool GetYarn (mdbYarn *outYarn) const

Static Public Member Functions

static mork_size SizeForFill (mork_fill inFill)
static void BadAtomKindError (morkEnv *ev)
static void ZeroAidError (morkEnv *ev)
static void AtomSizeOverflowError (morkEnv *ev)

Public Attributes

mork_u1 mWeeAnonAtom_Body [1]
mork_u1 mAtom_Kind
mork_u1 mAtom_CellUses
mork_change mAtom_Change
mork_u1 mAtom_Size

Private Member Functions

 morkWeeAnonAtom (const morkWeeAnonAtom &other)
morkWeeAnonAtomoperator= (const morkWeeAnonAtom &other)

Detailed Description

Definition at line 169 of file morkAtom.h.


Constructor & Destructor Documentation

Definition at line 180 of file morkAtom.h.

{ }

Here is the caller graph for this function:


Member Function Documentation

mork_u1 morkAtom::AddCellUse ( morkEnv ev) [inherited]

Definition at line 257 of file morkAtom.cpp.

{
  MORK_USED_1(ev); 
  if ( mAtom_CellUses < morkAtom_kMaxCellUses ) // not already maxed out?
    ++mAtom_CellUses;
    
  return mAtom_CellUses;
}

Here is the caller graph for this function:

mork_bool morkAtom::AliasYarn ( mdbYarn outYarn) const [inherited]

Definition at line 174 of file morkAtom.cpp.

{
  outYarn->mYarn_More = 0;
  outYarn->mYarn_Form = 0;
  const morkAtom* atom = this;
  
  if ( atom )
  {
    if ( atom->IsWeeBook() )
    {
      morkWeeBookAtom* weeBook = (morkWeeBookAtom*) atom;
      outYarn->mYarn_Buf = weeBook->mWeeBookAtom_Body;
      outYarn->mYarn_Fill = weeBook->mAtom_Size;
      outYarn->mYarn_Size = weeBook->mAtom_Size;
    }
    else if ( atom->IsBigBook() )
    {
      morkBigBookAtom* bigBook = (morkBigBookAtom*) atom;
      outYarn->mYarn_Buf = bigBook->mBigBookAtom_Body;
      outYarn->mYarn_Fill = bigBook->mBigBookAtom_Size;
      outYarn->mYarn_Size = bigBook->mBigBookAtom_Size;
      outYarn->mYarn_Form = bigBook->mBigBookAtom_Form;
    }
    else if ( atom->IsWeeAnon() )
    {
      morkWeeAnonAtom* weeAnon = (morkWeeAnonAtom*) atom;
      outYarn->mYarn_Buf = weeAnon->mWeeAnonAtom_Body;
      outYarn->mYarn_Fill = weeAnon->mAtom_Size;
      outYarn->mYarn_Size = weeAnon->mAtom_Size;
    }
    else if ( atom->IsBigAnon() )
    {
      morkBigAnonAtom* bigAnon = (morkBigAnonAtom*) atom;
      outYarn->mYarn_Buf = bigAnon->mBigAnonAtom_Body;
      outYarn->mYarn_Fill = bigAnon->mBigAnonAtom_Size;
      outYarn->mYarn_Size = bigAnon->mBigAnonAtom_Size;
      outYarn->mYarn_Form = bigAnon->mBigAnonAtom_Form;
    }
    else
      atom = 0; // show desire to put empty content in yarn
  }
  
  if ( !atom ) // empty content for yarn?
  {
    outYarn->mYarn_Buf = 0;
    outYarn->mYarn_Fill = 0;
    outYarn->mYarn_Size = 0;
    // outYarn->mYarn_Grow = 0; // please don't modify the Grow slot
  }
  return ( atom != 0 );
}

Here is the call graph for this function:

Here is the caller graph for this function:

mork_bool morkAtom::AsBuf ( morkBuf outBuf) const [inherited]

Definition at line 132 of file morkAtom.cpp.

{
  const morkAtom* atom = this;
  if ( atom )
  {
    if ( atom->IsWeeBook() )
    {
      morkWeeBookAtom* weeBook = (morkWeeBookAtom*) atom;
      outBuf.mBuf_Body = weeBook->mWeeBookAtom_Body;
      outBuf.mBuf_Fill = weeBook->mAtom_Size;
    }
    else if ( atom->IsBigBook() )
    {
      morkBigBookAtom* bigBook = (morkBigBookAtom*) atom;
      outBuf.mBuf_Body = bigBook->mBigBookAtom_Body;
      outBuf.mBuf_Fill = bigBook->mBigBookAtom_Size;
    }
    else if ( atom->IsWeeAnon() )
    {
      morkWeeAnonAtom* weeAnon = (morkWeeAnonAtom*) atom;
      outBuf.mBuf_Body = weeAnon->mWeeAnonAtom_Body;
      outBuf.mBuf_Fill = weeAnon->mAtom_Size;
    }
    else if ( atom->IsBigAnon() )
    {
      morkBigAnonAtom* bigAnon = (morkBigAnonAtom*) atom;
      outBuf.mBuf_Body = bigAnon->mBigAnonAtom_Body;
      outBuf.mBuf_Fill = bigAnon->mBigAnonAtom_Size;
    }
    else
      atom = 0; // show desire to put empty content in yarn
  }
  
  if ( !atom ) // empty content for yarn?
  {
    outBuf.mBuf_Body = 0;
    outBuf.mBuf_Fill = 0;
  }
  return ( atom != 0 );
}

Here is the call graph for this function:

void morkAtom::AtomSizeOverflowError ( morkEnv ev) [static, inherited]

Definition at line 299 of file morkAtom.cpp.

{
  ev->NewError("atom mAtom_Size overflow");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void morkAtom::BadAtomKindError ( morkEnv ev) [static, inherited]

Definition at line 287 of file morkAtom.cpp.

{
  ev->NewError("bad mAtom_Kind");
}

Here is the call graph for this function:

Here is the caller graph for this function:

mork_u1 morkAtom::CutCellUse ( morkEnv ev) [inherited]

Definition at line 267 of file morkAtom.cpp.

{
  if ( mAtom_CellUses ) // any outstanding uses to cut?
  {
    if ( mAtom_CellUses < morkAtom_kMaxCellUses ) // not frozen at max?
      --mAtom_CellUses;
  }
  else
    this->CellUsesUnderflowWarning(ev);
    
  return mAtom_CellUses;
}

Here is the call graph for this function:

Here is the caller graph for this function:

mork_aid morkAtom::GetBookAtomAid ( ) const [inherited]

Definition at line 227 of file morkAtom.cpp.

{
  return ( this->IsBook() )? ((morkBookAtom*) this)->mBookAtom_Id : 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

mork_scope morkAtom::GetBookAtomSpaceScope ( morkEnv ev) const [inherited]

Definition at line 233 of file morkAtom.cpp.

{
  mork_scope outScope = 0;
  if ( this->IsBook() )
  {
    const morkBookAtom* bookAtom = (const morkBookAtom*) this;
    morkAtomSpace* space = bookAtom->mBookAtom_Space;
    if ( space->IsAtomSpace() )
      outScope = space->SpaceScope();
    else
      space->NonAtomSpaceTypeError(ev);
  }
  
  return outScope;
}

Here is the call graph for this function:

Here is the caller graph for this function:

mork_bool morkAtom::GetYarn ( mdbYarn outYarn) const [inherited]

Definition at line 65 of file morkAtom.cpp.

{
  const void* source = 0;  
  mdb_fill fill = 0; 
  mdb_cscode form = 0;
  outYarn->mYarn_More = 0;

  if ( this )
  {
    if ( this->IsWeeBook() )
    {
      morkWeeBookAtom* weeBook = (morkWeeBookAtom*) this;
      source = weeBook->mWeeBookAtom_Body;
      fill = weeBook->mAtom_Size;
    }
    else if ( this->IsBigBook() )
    {
      morkBigBookAtom* bigBook = (morkBigBookAtom*) this;
      source = bigBook->mBigBookAtom_Body;
      fill = bigBook->mBigBookAtom_Size;
      form = bigBook->mBigBookAtom_Form;
    }
    else if ( this->IsWeeAnon() )
    {
      morkWeeAnonAtom* weeAnon = (morkWeeAnonAtom*) this;
      source = weeAnon->mWeeAnonAtom_Body;
      fill = weeAnon->mAtom_Size;
    }
    else if ( this->IsBigAnon() )
    {
      morkBigAnonAtom* bigAnon = (morkBigAnonAtom*) this;
      source = bigAnon->mBigAnonAtom_Body;
      fill = bigAnon->mBigAnonAtom_Size;
      form = bigAnon->mBigAnonAtom_Form;
    }
  }
  if ( source && fill ) // have an atom with nonempty content?
  {
    // if we have too many bytes, and yarn seems growable:
    if ( fill > outYarn->mYarn_Size && outYarn->mYarn_Grow ) // try grow?
      (*outYarn->mYarn_Grow)(outYarn, (mdb_size) fill); // request bigger
      
    mdb_size size = outYarn->mYarn_Size; // max dest size
    if ( fill > size ) // too much atom content?
    {
      outYarn->mYarn_More = fill - size; // extra atom bytes omitted
      fill = size; // copy no more bytes than size of yarn buffer
    }
    void* dest = outYarn->mYarn_Buf; // where bytes are going
    if ( !dest ) // nil destination address buffer?
      fill = 0; // we can't write any content at all
      
    if ( fill ) // anything to copy?
      MORK_MEMCPY(dest, source, fill); // copy fill bytes to yarn
      
    outYarn->mYarn_Fill = fill; // tell yarn size of copied content
  }
  else // no content to put into the yarn
  {
    outYarn->mYarn_Fill = 0; // tell yarn that atom has no bytes
  }
  outYarn->mYarn_Form = form; // always update the form slot
  
  return ( source != 0 );
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 327 of file morkAtom.cpp.

Here is the call graph for this function:

mork_bool morkAtom::IsAtomClean ( ) const [inline, inherited]

Definition at line 89 of file morkAtom.h.

mork_bool morkAtom::IsAtomDirty ( ) const [inline, inherited]

Definition at line 90 of file morkAtom.h.

Here is the caller graph for this function:

mork_bool morkAtom::IsBigAnon ( ) const [inline, inherited]

Definition at line 75 of file morkAtom.h.

Here is the caller graph for this function:

mork_bool morkAtom::IsBigBook ( ) const [inline, inherited]

Definition at line 77 of file morkAtom.h.

Here is the caller graph for this function:

mork_bool morkAtom::IsBook ( ) const [inline, inherited]

Definition at line 82 of file morkAtom.h.

{ return this->IsWeeBook() || this->IsBigBook(); }

Here is the call graph for this function:

Here is the caller graph for this function:

mork_bool morkAtom::IsCellUseForever ( ) const [inline, inherited]

Definition at line 108 of file morkAtom.h.

mork_bool morkAtom::IsFarBook ( ) const [inline, inherited]

Definition at line 78 of file morkAtom.h.

Here is the caller graph for this function:

mork_bool morkAtom::IsRowOid ( ) const [inline, inherited]

Definition at line 79 of file morkAtom.h.

Here is the caller graph for this function:

mork_bool morkAtom::IsTableOid ( ) const [inline, inherited]

Definition at line 80 of file morkAtom.h.

Here is the caller graph for this function:

mork_bool morkAtom::IsWeeAnon ( ) const [inline, inherited]

Definition at line 74 of file morkAtom.h.

Here is the caller graph for this function:

mork_bool morkAtom::IsWeeBook ( ) const [inline, inherited]

Definition at line 76 of file morkAtom.h.

Here is the caller graph for this function:

void morkAtom::MakeCellUseForever ( morkEnv ev) [inherited]

Definition at line 250 of file morkAtom.cpp.

Here is the caller graph for this function:

morkWeeAnonAtom& morkWeeAnonAtom::operator= ( const morkWeeAnonAtom other) [private]
void morkAtom::SetAtomClean ( ) [inline, inherited]

Definition at line 86 of file morkAtom.h.

Here is the caller graph for this function:

void morkAtom::SetAtomDirty ( ) [inline, inherited]

Definition at line 87 of file morkAtom.h.

Here is the caller graph for this function:

static mork_size morkWeeAnonAtom::SizeForFill ( mork_fill  inFill) [inline, static]

Definition at line 184 of file morkAtom.h.

  { return sizeof(morkWeeAnonAtom) + inFill; }

Here is the call graph for this function:

Here is the caller graph for this function:

void morkAtom::ZeroAidError ( morkEnv ev) [static, inherited]

Definition at line 293 of file morkAtom.cpp.

{
  ev->NewError("zero atom ID");
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 67 of file morkAtom.h.

Definition at line 68 of file morkAtom.h.

Definition at line 66 of file morkAtom.h.

Definition at line 69 of file morkAtom.h.

Definition at line 177 of file morkAtom.h.


The documentation for this class was generated from the following files: