Back to index

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

#include <morkRow.h>

Collaboration diagram for morkRow:
Collaboration graph
[legend]

List of all members.

Public Member Functions

mork_bool HasRowDelta () const
void ClearRowDelta ()
void SetRowDelta (mork_column inCol, mork_change inChange)
mork_column GetDeltaColumn () const
mork_change GetDeltaChange () const
void NoteRowSetAll (morkEnv *ev)
void NoteRowSetCol (morkEnv *ev, mork_column inCol)
void NoteRowAddCol (morkEnv *ev, mork_column inCol)
void NoteRowCutCol (morkEnv *ev, mork_column inCol)
void SetRowNoted ()
void SetRowRewrite ()
void SetRowDirty ()
void ClearRowNoted ()
void ClearRowRewrite ()
void SetRowClean ()
mork_bool IsRowNoted () const
mork_bool IsRowRewrite () const
mork_bool IsRowClean () const
mork_bool IsRowDirty () const
mork_bool IsRowUsed () const
 morkRow ()
 morkRow (const mdbOid *inOid)
void InitRow (morkEnv *ev, const mdbOid *inOid, morkRowSpace *ioSpace, mork_size inLength, morkPool *ioPool)
morkRowObjectAcquireRowObject (morkEnv *ev, morkStore *ioStore)
nsIMdbRowAcquireRowHandle (morkEnv *ev, morkStore *ioStore)
nsIMdbCellAcquireCellHandle (morkEnv *ev, morkCell *ioCell, mdb_column inColumn, mork_pos inPos)
mork_u2 AddRowGcUse (morkEnv *ev)
mork_u2 CutRowGcUse (morkEnv *ev)
mork_bool MaybeDirtySpaceStoreAndRow ()
void cut_all_index_entries (morkEnv *ev)
mork_count CountOverlap (morkEnv *ev, morkCell *ioVector, mork_fill inFill)
void MergeCells (morkEnv *ev, morkCell *ioVector, mork_fill inVecLength, mork_fill inOldRowFill, mork_fill inOverlap)
void TakeCells (morkEnv *ev, morkCell *ioVector, mork_fill inVecLength, morkStore *ioStore)
morkCellNewCell (morkEnv *ev, mdb_column inColumn, mork_pos *outPos, morkStore *ioStore)
morkCellGetCell (morkEnv *ev, mdb_column inColumn, mork_pos *outPos) const
morkCellCellAt (morkEnv *ev, mork_pos inPos) const
mork_aid GetCellAtomAid (morkEnv *ev, mdb_column inColumn) const
void DirtyAllRowContent (morkEnv *ev)
morkStoreGetRowSpaceStore (morkEnv *ev) const
void AddColumn (morkEnv *ev, mdb_column inColumn, const mdbYarn *inYarn, morkStore *ioStore)
morkAtomGetColumnAtom (morkEnv *ev, mdb_column inColumn)
void NextColumn (morkEnv *ev, mdb_column *ioColumn, mdbYarn *outYarn)
void SeekColumn (morkEnv *ev, mdb_pos inPos, mdb_column *outColumn, mdbYarn *outYarn)
void CutColumn (morkEnv *ev, mdb_column inColumn)
morkRowCellCursorNewRowCellCursor (morkEnv *ev, mdb_pos inPos)
void EmptyAllCells (morkEnv *ev)
void AddRow (morkEnv *ev, const morkRow *inSourceRow)
void SetRow (morkEnv *ev, const morkRow *inSourceRow)
void CutAllColumns (morkEnv *ev)
void OnZeroRowGcUse (morkEnv *ev)
mork_bool IsRow () const
mork_u4 HashRow () const
mork_bool EqualRow (const morkRow *ioRow) const
mork_bool EqualOid (const mdbOid *ioOid) const

Static Public Member Functions

static void ZeroColumnError (morkEnv *ev)
static void LengthBeyondMaxError (morkEnv *ev)
static void NilCellsError (morkEnv *ev)
static void NonRowTypeError (morkEnv *ev)
static void NonRowTypeWarning (morkEnv *ev)
static void GcUsesUnderflowWarning (morkEnv *ev)

Public Attributes

morkRowSpacemRow_Space
morkRowObjectmRow_Object
morkCellmRow_Cells
mdbOid mRow_Oid
mork_delta mRow_Delta
mork_u2 mRow_Length
mork_u2 mRow_Seed
mork_u1 mRow_GcUses
mork_u1 mRow_Pad
mork_u1 mRow_Flags
mork_u1 mRow_Tag

Private Member Functions

 morkRow (const morkRow &other)
morkRowoperator= (const morkRow &other)

Detailed Description

Definition at line 65 of file morkRow.h.


Constructor & Destructor Documentation

morkRow::morkRow ( ) [inline]

Definition at line 129 of file morkRow.h.

{ }
morkRow::morkRow ( const mdbOid inOid) [inline]

Definition at line 130 of file morkRow.h.

:mRow_Oid(*inOid) { }
morkRow::morkRow ( const morkRow other) [private]

Member Function Documentation

nsIMdbCell * morkRow::AcquireCellHandle ( morkEnv ev,
morkCell ioCell,
mdb_column  inColumn,
mork_pos  inPos 
)

Definition at line 288 of file morkRow.cpp.

{
  nsIMdbHeap* heap = ev->mEnv_Heap;
  morkCellObject* cellObj = new(*heap, ev)
    morkCellObject(ev, morkUsage::kHeap, heap, this, ioCell, inCol, inPos);
  if ( cellObj )
  {
    nsIMdbCell* cellHandle = cellObj->AcquireCellHandle(ev);
//    cellObj->CutStrongRef(ev->AsMdbEnv());
    return cellHandle;
  }
  return (nsIMdbCell*) 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 282 of file morkRow.cpp.

{
  return AcquireRowObject(ev, ioStore);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 264 of file morkRow.cpp.

{
  morkRowObject* ro = mRow_Object;
  if ( ro ) // need new row object?
    ro->AddRef();
  else
  {
    nsIMdbHeap* heap = ioStore->mPort_Heap;
    ro = new(*heap, ev)
      morkRowObject(ev, morkUsage::kHeap, heap, this, ioStore);

    morkRowObject::SlotWeakRowObject(ro, ev, &mRow_Object);
    ro->AddRef();
  }
  return ro;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void morkRow::AddColumn ( morkEnv ev,
mdb_column  inColumn,
const mdbYarn inYarn,
morkStore ioStore 
)

Definition at line 876 of file morkRow.cpp.

{
  if ( ev->Good() )
  {
    mork_pos pos = -1;
    morkCell* cell = this->GetCell(ev, inColumn, &pos);
    morkCell* oldCell = cell; // need to know later whether new
    if ( !cell ) // column does not yet exist?
      cell = this->NewCell(ev, inColumn, &pos, ioStore);
    
    if ( cell )
    {
      morkAtom* oldAtom = cell->mCell_Atom;

      morkAtom* atom = ioStore->YarnToAtom(ev, inYarn, PR_TRUE /* create */);
      if ( atom && atom != oldAtom )
      {
        morkRowSpace* rowSpace = mRow_Space;
        morkAtomRowMap* map = ( rowSpace->mRowSpace_IndexCount )?
          rowSpace->FindMap(ev, inColumn) : (morkAtomRowMap*) 0;
        
        if ( map ) // inColumn is indexed by row space?
        {
          if ( oldAtom && oldAtom != atom ) // cut old cell from index?
          {
            mork_aid oldAid = oldAtom->GetBookAtomAid();
            if ( oldAid ) // cut old row attribute from row index in space?
              map->CutAid(ev, oldAid);
          }
        }
        
        cell->SetAtom(ev, atom, ioStore->StorePool()); // refcounts atom

        if ( oldCell ) // we changed a pre-existing cell in the row?
        {
          ++mRow_Seed;
          if ( this->MaybeDirtySpaceStoreAndRow() && !this->IsRowRewrite() )
            this->NoteRowAddCol(ev, inColumn);
        }

        if ( map ) // inColumn is indexed by row space?
        {
          mork_aid newAid = atom->GetBookAtomAid();
          if ( newAid ) // add new row attribute to row index in space?
            map->AddAid(ev, newAid, this);
        }
      }
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void morkRow::AddRow ( morkEnv ev,
const morkRow inSourceRow 
)

Definition at line 747 of file morkRow.cpp.

{
  if ( mRow_Length ) // any existing cells we might need to keep?
  {
    ev->StubMethodOnlyError();
  }
  else
    this->SetRow(ev, inSourceRow); // just exactly duplicate inSourceRow
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 149 of file morkRow.cpp.

{
  if ( this->IsRow() )
  {
    if ( mRow_GcUses < morkRow_kMaxGcUses ) // not already maxed out?
      ++mRow_GcUses;
  }
  else
    this->NonRowTypeError(ev);
    
  return mRow_GcUses;
}

Here is the call graph for this function:

Here is the caller graph for this function:

morkCell * morkRow::CellAt ( morkEnv ev,
mork_pos  inPos 
) const

Definition at line 525 of file morkRow.cpp.

{
  MORK_USED_1(ev);
  morkCell* cells = mRow_Cells;
  if ( cells && inPos < mRow_Length && inPos >= 0 )
  {
    return cells + inPos;
  }
  return (morkCell*) 0;
}

Here is the caller graph for this function:

Definition at line 88 of file morkRow.h.

{ mRow_Delta = 0; }

Here is the caller graph for this function:

Definition at line 109 of file morkRow.h.

Definition at line 110 of file morkRow.h.

mork_count morkRow::CountOverlap ( morkEnv ev,
morkCell ioVector,
mork_fill  inFill 
)

Definition at line 304 of file morkRow.cpp.

{
  mork_count outCount = 0;
  mork_pos pos = 0; // needed by GetCell()
  morkCell* cells = ioVector;
  morkCell* end = cells + inFill;
  --cells; // prepare for preincrement
  while ( ++cells < end && ev->Good() )
  {
    mork_column col = cells->GetColumn();
    
    morkCell* old = this->GetCell(ev, col, &pos);
    if ( old ) // same column?
    {
      mork_change newChg = cells->GetChange();
      mork_change oldChg = old->GetChange();
      if ( newChg != morkChange_kCut || oldChg != newChg ) // not cut+cut?
      {
        if ( cells->mCell_Atom != old->mCell_Atom ) // not same atom?
          ++outCount; // cells will replace old significantly when added
      }
      else
        cells->SetColumnAndChange(col, morkChange_kDup); // note dup status
    }
  }
  return outCount;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 623 of file morkRow.cpp.

{
  morkRowSpace* rowSpace = mRow_Space;
  if ( rowSpace->mRowSpace_IndexCount ) // any indexes?
  {
    morkCell* cells = mRow_Cells;
    if ( cells )
    {
      morkCell* end = cells + mRow_Length;
      --cells; // prepare for preincrement:
      while ( ++cells < end )
      {
        morkAtom* atom = cells->mCell_Atom;
        if ( atom )
        {
          mork_aid atomAid = atom->GetBookAtomAid();
          if ( atomAid )
          {
            mork_column col = cells->GetColumn();
            morkAtomRowMap* map = rowSpace->FindMap(ev, col);
            if ( map ) // cut row from index for this column?
              map->CutAid(ev, atomAid);
          }
        }
      }
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 653 of file morkRow.cpp.

{
  morkStore* store = this->GetRowSpaceStore(ev);
  if ( store )
  {
    if ( this->MaybeDirtySpaceStoreAndRow() )
    {
      this->SetRowRewrite();
      this->NoteRowSetAll(ev);
    }
    morkRowSpace* rowSpace = mRow_Space;
    if ( rowSpace->mRowSpace_IndexCount ) // any indexes?
      this->cut_all_index_entries(ev);
  
    morkPool* pool = store->StorePool();
    pool->CutRowCells(ev, this, /*newSize*/ 0, &store->mStore_Zone);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void morkRow::CutColumn ( morkEnv ev,
mdb_column  inColumn 
)

Definition at line 812 of file morkRow.cpp.

{
  mork_pos pos = -1;
  morkCell* cell = this->GetCell(ev, inColumn, &pos);
  if ( cell ) 
  {
    morkStore* store = this->GetRowSpaceStore(ev);
    if ( store )
    {
      if ( this->MaybeDirtySpaceStoreAndRow() && !this->IsRowRewrite() )
        this->NoteRowCutCol(ev, inColumn);
        
      morkRowSpace* rowSpace = mRow_Space;
      morkAtomRowMap* map = ( rowSpace->mRowSpace_IndexCount )?
        rowSpace->FindMap(ev, inColumn) : (morkAtomRowMap*) 0;
      if ( map ) // this row attribute is indexed by row space?
      {
        morkAtom* oldAtom = cell->mCell_Atom;
        if ( oldAtom ) // need to cut an entry from the index?
        {
          mork_aid oldAid = oldAtom->GetBookAtomAid();
          if ( oldAid ) // cut old row attribute from row index in space?
            map->CutAid(ev, oldAid);
        }
      }
      
      morkPool* pool = store->StorePool();
      cell->SetAtom(ev, (morkAtom*) 0, pool);
      
      mork_fill fill = mRow_Length; // should not be zero
      MORK_ASSERT(fill);
      if ( fill ) // index < fill for last cell exists?
      {
        mork_fill last = fill - 1; // index of last cell in row
        
        if ( pos < (mork_pos)last ) // need to move cells following cut cell?
        {
          morkCell* lastCell = mRow_Cells + last;
          mork_count after = last - pos; // cell count after cut cell
          morkCell* next = cell + 1; // next cell after cut cell
          MORK_MEMMOVE(cell, next, after * sizeof(morkCell));
          lastCell->SetColumnAndChange(0, 0);
          lastCell->mCell_Atom = 0;
        }
        
        if ( ev->Good() )
          pool->CutRowCells(ev, this, fill - 1, &store->mStore_Zone);
      }
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 163 of file morkRow.cpp.

{
  if ( this->IsRow() )
  {
    if ( mRow_GcUses ) // any outstanding uses to cut?
    {
      if ( mRow_GcUses < morkRow_kMaxGcUses ) // not frozen at max?
        --mRow_GcUses;
    }
    else
      this->GcUsesUnderflowWarning(ev);
  }
  else
    this->NonRowTypeError(ev);
    
  return mRow_GcUses;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 766 of file morkRow.cpp.

{
  MORK_USED_1(ev);

  if ( this->MaybeDirtySpaceStoreAndRow() )
  {
    this->SetRowRewrite();
    this->NoteRowSetAll(ev);
  }
  morkCell* cells = mRow_Cells;
  if ( cells )
  {
    morkCell* end = cells + mRow_Length;
    --cells; // prepare for preincrement:
    while ( ++cells < end )
    {
      cells->SetCellDirty();
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 597 of file morkRow.cpp.

{
  morkCell* cells = mRow_Cells;
  if ( cells )
  {
    morkStore* store = this->GetRowSpaceStore(ev);
    if ( store )
    {
      if ( this->MaybeDirtySpaceStoreAndRow() )
      {
        this->SetRowRewrite();
        this->NoteRowSetAll(ev);
      }
      morkPool* pool = store->StorePool();
      morkCell* end = cells + mRow_Length;
      --cells; // prepare for preincrement:
      while ( ++cells < end )
      {
        if ( cells->mCell_Atom )
          cells->SetAtom(ev, (morkAtom*) 0, pool);
      }
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

mork_bool morkRow::EqualOid ( const mdbOid ioOid) const [inline]

Definition at line 233 of file morkRow.h.

  {
    return
    (
      ( mRow_Oid.mOid_Scope == ioOid->mOid_Scope ) 
      && ( mRow_Oid.mOid_Id == ioOid->mOid_Id )
    );
  }

Here is the caller graph for this function:

mork_bool morkRow::EqualRow ( const morkRow ioRow) const [inline]

Definition at line 224 of file morkRow.h.

  {
    return
    (
      ( mRow_Oid.mOid_Scope == ioRow->mRow_Oid.mOid_Scope ) 
      && ( mRow_Oid.mOid_Id == ioRow->mRow_Oid.mOid_Id )
    );
  }

Here is the caller graph for this function:

Definition at line 182 of file morkRow.cpp.

{
  ev->NewWarning("mRow_GcUses underflow");
}

Here is the call graph for this function:

Here is the caller graph for this function:

morkCell * morkRow::GetCell ( morkEnv ev,
mdb_column  inColumn,
mork_pos outPos 
) const

Definition at line 537 of file morkRow.cpp.

{
  MORK_USED_1(ev);
  morkCell* cells = mRow_Cells;
  if ( cells )
  {
    morkCell* end = cells + mRow_Length;
    while ( cells < end )
    {
      mork_column col = cells->GetColumn();
      if ( col == inColumn ) // found the desired column?
      {
        *outPos = cells - mRow_Cells;
        return cells;
      }
      else
        ++cells;
    }
  }
  *outPos = -1;
  return (morkCell*) 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

mork_aid morkRow::GetCellAtomAid ( morkEnv ev,
mdb_column  inColumn 
) const

Definition at line 561 of file morkRow.cpp.

{
  if ( this && this->IsRow() )
  {
    morkCell* cells = mRow_Cells;
    if ( cells )
    {
      morkCell* end = cells + mRow_Length;
      while ( cells < end )
      {
        mork_column col = cells->GetColumn();
        if ( col == inColumn ) // found desired column?
        {
          morkAtom* atom = cells->mCell_Atom;
          if ( atom && atom->IsBook() )
            return ((morkBookAtom*) atom)->mBookAtom_Id;
          else
            return 0;
        }
        else
          ++cells;
      }
    }
  }
  else
    this->NonRowTypeError(ev);

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

morkAtom * morkRow::GetColumnAtom ( morkEnv ev,
mdb_column  inColumn 
)

Definition at line 864 of file morkRow.cpp.

{
  if ( ev->Good() )
  {
    mork_pos pos = -1;
    morkCell* cell = this->GetCell(ev, inColumn, &pos);
    if ( cell )
       return cell->mCell_Atom;
  }
  return (morkAtom*) 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 94 of file morkRow.h.

Here is the caller graph for this function:

Definition at line 93 of file morkRow.h.

Here is the caller graph for this function:

Definition at line 788 of file morkRow.cpp.

{
  morkRowSpace* rowSpace = mRow_Space;
  if ( rowSpace )
  {
    morkStore* store = rowSpace->mSpace_Store;
    if ( store )
    {
      if ( store->IsStore() )
      {
        return store;
      }
      else
        store->NonStoreTypeError(ev);
    }
    else
      ev->NilPointerError();
  }
  else
    ev->NilPointerError();
    
  return (morkStore*) 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

mork_u4 morkRow::HashRow ( ) const [inline]

Definition at line 219 of file morkRow.h.

  {
    return (mRow_Oid.mOid_Scope << 16) ^ mRow_Oid.mOid_Id;
  }

Here is the caller graph for this function:

mork_bool morkRow::HasRowDelta ( ) const [inline]

Definition at line 86 of file morkRow.h.

{ return ( mRow_Delta != 0 ); }

Here is the caller graph for this function:

void morkRow::InitRow ( morkEnv ev,
const mdbOid inOid,
morkRowSpace ioSpace,
mork_size  inLength,
morkPool ioPool 
)

Definition at line 219 of file morkRow.cpp.

{
  if ( ioSpace && ioPool && inOid )
  {
    if ( inLength <= morkRow_kMaxLength )
    {
      if ( inOid->mOid_Id != morkRow_kMinusOneRid )
      {
        mRow_Space = ioSpace;
        mRow_Object = 0;
        mRow_Cells = 0;
        mRow_Oid = *inOid;

        mRow_Length = (mork_u2) inLength;
        mRow_Seed = (mork_u2) (mork_ip) this; // "random" assignment

        mRow_GcUses = 0;
        mRow_Pad = 0;
        mRow_Flags = 0;
        mRow_Tag = morkRow_kTag;
        
        morkZone* zone = &ioSpace->mSpace_Store->mStore_Zone;

        if ( inLength )
          mRow_Cells = ioPool->NewCells(ev, inLength, zone);

        if ( this->MaybeDirtySpaceStoreAndRow() ) // new row might dirty store
        {
          this->SetRowRewrite();
          this->NoteRowSetAll(ev);
        }
      }
      else
        ioSpace->MinusOneRidError(ev);
    }
    else
      this->LengthBeyondMaxError(ev);
  }
  else
    ev->NilPointerError();
}

Here is the call graph for this function:

Here is the caller graph for this function:

mork_bool morkRow::IsRow ( ) const [inline]

Definition at line 215 of file morkRow.h.

{ return mRow_Tag == morkRow_kTag; }

Here is the caller graph for this function:

mork_bool morkRow::IsRowClean ( ) const [inline]

Definition at line 119 of file morkRow.h.

  { return ( mRow_Flags & morkRow_kDirtyBit ) == 0; }

Here is the caller graph for this function:

mork_bool morkRow::IsRowDirty ( ) const [inline]

Definition at line 122 of file morkRow.h.

  { return ( mRow_Flags & morkRow_kDirtyBit ) != 0; }

Here is the caller graph for this function:

mork_bool morkRow::IsRowNoted ( ) const [inline]

Definition at line 113 of file morkRow.h.

  { return ( mRow_Flags & morkRow_kNotedBit ) != 0; }
mork_bool morkRow::IsRowRewrite ( ) const [inline]

Definition at line 116 of file morkRow.h.

  { return ( mRow_Flags & morkRow_kRewriteBit ) != 0; }

Here is the caller graph for this function:

mork_bool morkRow::IsRowUsed ( ) const [inline]

Definition at line 125 of file morkRow.h.

  { return mRow_GcUses != 0; }

Here is the caller graph for this function:

Definition at line 201 of file morkRow.cpp.

{
  ev->NewError("mRow_Length over max");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 419 of file morkRow.cpp.

{
  morkRowSpace* rowSpace = mRow_Space;
  if ( rowSpace )
  {
    morkStore* store = rowSpace->mSpace_Store;
    if ( store && store->mStore_CanDirty )
    {
      store->SetStoreDirty();
      rowSpace->mSpace_CanDirty = morkBool_kTrue;
    }
    
    if ( rowSpace->mSpace_CanDirty )
    {
      this->SetRowDirty();
      rowSpace->SetRowSpaceDirty();
      return morkBool_kTrue;
    }
  }
  return morkBool_kFalse;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void morkRow::MergeCells ( morkEnv ev,
morkCell ioVector,
mork_fill  inVecLength,
mork_fill  inOldRowFill,
mork_fill  inOverlap 
)

Definition at line 343 of file morkRow.cpp.

{
  morkCell* newCells = mRow_Cells + inOldRowFill; // 1st new cell in row
  morkCell* newEnd = newCells + mRow_Length; // one past last cell

  morkCell* srcCells = ioVector;
  morkCell* srcEnd = srcCells + inVecLength;
  
  --srcCells; // prepare for preincrement
  while ( ++srcCells < srcEnd && ev->Good() )
  {
    mork_change srcChg = srcCells->GetChange();
    if ( srcChg != morkChange_kDup ) // anything to be done?
    {
      morkCell* dstCell = 0;
      if ( inOverlap )
      {
        mork_pos pos = 0; // needed by GetCell()
        dstCell = this->GetCell(ev, srcCells->GetColumn(), &pos);
      }
      if ( dstCell )
      {
        --inOverlap; // one fewer intersections to resolve
        // swap the atoms in the cells to avoid ref counting here:
        morkAtom* dstAtom = dstCell->mCell_Atom;
        *dstCell = *srcCells; // bitwise copy, taking src atom
        srcCells->mCell_Atom = dstAtom; // forget cell ref, if any
      }
      else if ( newCells < newEnd ) // another new cell exists?
      {
        dstCell = newCells++; // alloc another new cell
        // take atom from source cell, transferring ref to this row:
        *dstCell = *srcCells; // bitwise copy, taking src atom
        srcCells->mCell_Atom = 0; // forget cell ref, if any
      }
      else // oops, we ran out...
        ev->NewError("out of new cells");
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

morkCell * morkRow::NewCell ( morkEnv ev,
mdb_column  inColumn,
mork_pos outPos,
morkStore ioStore 
)

Definition at line 442 of file morkRow.cpp.

{
  ++mRow_Seed; // intend to change structure of mRow_Cells
  mork_size length = (mork_size) mRow_Length;
  *outPos = (mork_pos) length;
  morkPool* pool = ioStore->StorePool();
  morkZone* zone = &ioStore->mStore_Zone;
  
  mork_bool canDirty = this->MaybeDirtySpaceStoreAndRow();
  
  if ( pool->AddRowCells(ev, this, length + 1, zone) )
  {
    morkCell* cell = mRow_Cells + length;
    // next line equivalent to inline morkCell::SetCellDirty():
    if ( canDirty )
      cell->SetCellColumnDirty(inColumn);
    else
      cell->SetCellColumnClean(inColumn);
      
    if ( canDirty && !this->IsRowRewrite() )
      this->NoteRowAddCol(ev, inColumn);
      
    return cell;
  }
    
  return (morkCell*) 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 929 of file morkRow.cpp.

{
  morkRowCellCursor* outCursor = 0;
  if ( ev->Good() )
  {
    morkStore* store = this->GetRowSpaceStore(ev);
    if ( store )
    {
      morkRowObject* rowObj = this->AcquireRowObject(ev, store);
      if ( rowObj )
      {
        nsIMdbHeap* heap = store->mPort_Heap;
        morkRowCellCursor* cursor = new(*heap, ev)
          morkRowCellCursor(ev, morkUsage::kHeap, heap, rowObj);
         
        if ( cursor )
        {
          if ( ev->Good() )
          {
            cursor->mCursor_Pos = inPos;
            outCursor = cursor;
          }
          else
            cursor->CutStrongRef(ev->mEnv_SelfAsMdbEnv);
        }
        rowObj->Release(); // always cut ref (cursor has its own)
      }
    }
  }
  return outCursor;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void morkRow::NextColumn ( morkEnv ev,
mdb_column ioColumn,
mdbYarn outYarn 
)

Definition at line 495 of file morkRow.cpp.

{
  morkCell* cells = mRow_Cells;
  if ( cells )
  {
       mork_column last = 0;
       mork_column inCol = *ioColumn;
    morkCell* end = cells + mRow_Length;
    while ( cells < end )
    {
      if ( inCol == last ) // found column?
      {
                  if ( outYarn )
                     cells->mCell_Atom->GetYarn(outYarn); // nil atom works okay here
        *ioColumn = cells->GetColumn();
        return;  // stop, we are done
      }
      else
      {
        last = cells->GetColumn();
        ++cells;
      }
    }
  }
       *ioColumn = 0;
  if ( outYarn )
       ((morkAtom*) 0)->GetYarn(outYarn); // yes this will work
}

Here is the call graph for this function:

Here is the caller graph for this function:

void morkRow::NilCellsError ( morkEnv ev) [static]

Definition at line 213 of file morkRow.cpp.

{
  ev->NewError("nil mRow_Cells");
}

Here is the call graph for this function:

Definition at line 189 of file morkRow.cpp.

{
  ev->NewError("non morkRow");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 195 of file morkRow.cpp.

{
  ev->NewWarning("non morkRow");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 91 of file morkRow.cpp.

{
  if ( !this->IsRowRewrite() )
  {
    mork_delta newDelta;
    morkDelta_Init(newDelta, inColumn, morkChange_kAdd);
    
    if ( newDelta != mRow_Delta ) // not repeating existing data?
    {
      if ( this->HasRowDelta() ) // already have one change recorded?
        this->SetRowRewrite(); // just plan to write all row cells
      else
        this->SetRowDelta(inColumn, morkChange_kAdd);
    }
  }
  else
    this->ClearRowDelta();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 110 of file morkRow.cpp.

{
  if ( !this->IsRowRewrite() )
  {
    mork_delta newDelta;
    morkDelta_Init(newDelta, inColumn, morkChange_kCut);
    
    if ( newDelta != mRow_Delta ) // not repeating existing data?
    {
      if ( this->HasRowDelta() ) // already have one change recorded?
        this->SetRowRewrite(); // just plan to write all row cells
      else
        this->SetRowDelta(inColumn, morkChange_kCut);
    }
  }
  else
    this->ClearRowDelta();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 142 of file morkRow.cpp.

{
  this->SetRowRewrite(); // just plan to write all row cells
  this->ClearRowDelta();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 129 of file morkRow.cpp.

{
  if ( !this->IsRowRewrite() )
  {
    if ( this->HasRowDelta() ) // already have one change recorded?
      this->SetRowRewrite(); // just plan to write all row cells
    else
      this->SetRowDelta(inColumn, morkChange_kSet);
  }
  else
    this->ClearRowDelta();
}

Here is the call graph for this function:

Definition at line 758 of file morkRow.cpp.

{
  MORK_USED_1(ev);
  // ev->NewWarning("need to implement OnZeroRowGcUse");
}

Here is the caller graph for this function:

morkRow& morkRow::operator= ( const morkRow other) [private]
void morkRow::SeekColumn ( morkEnv ev,
mdb_pos  inPos,
mdb_column outColumn,
mdbYarn outYarn 
)

Definition at line 473 of file morkRow.cpp.

{
  morkCell* cells = mRow_Cells;
  if ( cells && inPos < mRow_Length && inPos >= 0 )
  {
    morkCell* c = cells + inPos;
    if ( outColumn )
       *outColumn = c->GetColumn();
    if ( outYarn )
       c->mCell_Atom->GetYarn(outYarn); // nil atom works okay here
  }
  else
  {
    if ( outColumn )
       *outColumn = 0;
    if ( outYarn )
       ((morkAtom*) 0)->GetYarn(outYarn); // yes this will work
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void morkRow::SetRow ( morkEnv ev,
const morkRow inSourceRow 
)

Definition at line 673 of file morkRow.cpp.

{  
  // note inSourceRow might be in another DB, with a different store...
  morkStore* store = this->GetRowSpaceStore(ev);
  morkStore* srcStore = inSourceRow->GetRowSpaceStore(ev);
  if ( store && srcStore )
  {
    if ( this->MaybeDirtySpaceStoreAndRow() )
    {
      this->SetRowRewrite();
      this->NoteRowSetAll(ev);
    }
    morkRowSpace* rowSpace = mRow_Space;
    mork_count indexes = rowSpace->mRowSpace_IndexCount; // any indexes?
    
    mork_bool sameStore = ( store == srcStore ); // identical stores?
    morkPool* pool = store->StorePool();
    if ( pool->CutRowCells(ev, this, /*newSize*/ 0, &store->mStore_Zone) )
    {
      mork_fill fill = inSourceRow->mRow_Length;
      if ( pool->AddRowCells(ev, this, fill, &store->mStore_Zone) )
      {
        morkCell* dst = mRow_Cells;
        morkCell* dstEnd = dst + mRow_Length;
        
        const morkCell* src = inSourceRow->mRow_Cells;
        const morkCell* srcEnd = src + fill;
        --dst; --src; // prepare both for preincrement:
        
        while ( ++dst < dstEnd && ++src < srcEnd && ev->Good() )
        {
          morkAtom* atom = src->mCell_Atom;
          mork_column dstCol = src->GetColumn();
          // Note we modify the mCell_Atom slot directly instead of using
          // morkCell::SetAtom(), because we know it starts equal to nil.
          
          if ( sameStore ) // source and dest in same store?
          {
            // next line equivalent to inline morkCell::SetCellDirty():
            dst->SetCellColumnDirty(dstCol);
            dst->mCell_Atom = atom;
            if ( atom ) // another ref to non-nil atom?
              atom->AddCellUse(ev);
          }
          else // need to dup items from src store in a dest store
          {
            dstCol = store->CopyToken(ev, dstCol, srcStore);
            if ( dstCol )
            {
              // next line equivalent to inline morkCell::SetCellDirty():
              dst->SetCellColumnDirty(dstCol);
              atom = store->CopyAtom(ev, atom);
              dst->mCell_Atom = atom;
              if ( atom ) // another ref?
                atom->AddCellUse(ev);
            }
          }
          if ( indexes && atom )
          {
            mork_aid atomAid = atom->GetBookAtomAid();
            if ( atomAid )
            {
              morkAtomRowMap* map = rowSpace->FindMap(ev, dstCol);
              if ( map )
                map->AddAid(ev, atomAid, this);
            }
          }
        }
      }
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void morkRow::SetRowClean ( ) [inline]

Definition at line 111 of file morkRow.h.

{ mRow_Flags = 0; mRow_Delta = 0; }

Here is the caller graph for this function:

void morkRow::SetRowDelta ( mork_column  inCol,
mork_change  inChange 
) [inline]

Definition at line 90 of file morkRow.h.

  { morkDelta_Init(mRow_Delta, inCol, inChange); }

Here is the caller graph for this function:

void morkRow::SetRowDirty ( ) [inline]

Definition at line 107 of file morkRow.h.

Here is the caller graph for this function:

void morkRow::SetRowNoted ( ) [inline]

Definition at line 105 of file morkRow.h.

Definition at line 106 of file morkRow.h.

Here is the caller graph for this function:

void morkRow::TakeCells ( morkEnv ev,
morkCell ioVector,
mork_fill  inVecLength,
morkStore ioStore 
)

Definition at line 389 of file morkRow.cpp.

{
  if ( ioVector && inVecLength && ev->Good() )
  {
    ++mRow_Seed; // intend to change structure of mRow_Cells
    mork_size length = (mork_size) mRow_Length;
    
    mork_count overlap = this->CountOverlap(ev, ioVector, inVecLength);

    mork_size growth = inVecLength - overlap; // cells to add
    mork_size newLength = length + growth;
    
    if ( growth && ev->Good() ) // need to add any cells?
    {
      morkZone* zone = &ioStore->mStore_Zone;
      morkPool* pool = ioStore->StorePool();
      if ( !pool->AddRowCells(ev, this, length + growth, zone) )
        ev->NewError("cannot take cells");
    }
    if ( ev->Good() )
    {
      if ( mRow_Length >= newLength )
        this->MergeCells(ev, ioVector, inVecLength, length, overlap);
      else
        ev->NewError("not enough new cells");
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 207 of file morkRow.cpp.

{
  ev->NewError(" zero mork_column");
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 71 of file morkRow.h.

Definition at line 74 of file morkRow.h.

Definition at line 81 of file morkRow.h.

Definition at line 79 of file morkRow.h.

Definition at line 76 of file morkRow.h.

Definition at line 70 of file morkRow.h.

Definition at line 72 of file morkRow.h.

Definition at line 80 of file morkRow.h.

Definition at line 77 of file morkRow.h.

Definition at line 69 of file morkRow.h.

Definition at line 82 of file morkRow.h.


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