Back to index

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

#include <morkFactory.h>

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

List of all members.

Public Member Functions

virtual void CloseMorkNode (morkEnv *ev)
virtual ~morkFactory ()
NS_IMETHOD OpenOldFile (nsIMdbEnv *ev, nsIMdbHeap *ioHeap, const char *inFilePath, mdb_bool inFrozen, nsIMdbFile **acqFile)
NS_IMETHOD CreateNewFile (nsIMdbEnv *ev, nsIMdbHeap *ioHeap, const char *inFilePath, nsIMdbFile **acqFile)
NS_IMETHOD MakeEnv (nsIMdbHeap *ioHeap, nsIMdbEnv **acqEnv)
NS_IMETHOD MakeHeap (nsIMdbEnv *ev, nsIMdbHeap **acqHeap)
NS_IMETHOD MakeCompare (nsIMdbEnv *ev, nsIMdbCompare **acqCompare)
NS_IMETHOD MakeRow (nsIMdbEnv *ev, nsIMdbHeap *ioHeap, nsIMdbRow **acqRow)
NS_IMETHOD CanOpenFilePort (nsIMdbEnv *ev, nsIMdbFile *ioFile, mdb_bool *outCanOpen, mdbYarn *outFormatVersion)
NS_IMETHOD OpenFilePort (nsIMdbEnv *ev, nsIMdbHeap *ioHeap, nsIMdbFile *ioFile, const mdbOpenPolicy *inOpenPolicy, nsIMdbThumb **acqThumb)
NS_IMETHOD ThumbToOpenPort (nsIMdbEnv *ev, nsIMdbThumb *ioThumb, nsIMdbPort **acqPort)
NS_IMETHOD CanOpenFileStore (nsIMdbEnv *ev, nsIMdbFile *ioFile, mdb_bool *outCanOpenAsStore, mdb_bool *outCanOpenAsPort, mdbYarn *outFormatVersion)
NS_IMETHOD OpenFileStore (nsIMdbEnv *ev, nsIMdbHeap *ioHeap, nsIMdbFile *ioFile, const mdbOpenPolicy *inOpenPolicy, nsIMdbThumb **acqThumb)
NS_IMETHOD ThumbToOpenStore (nsIMdbEnv *ev, nsIMdbThumb *ioThumb, nsIMdbStore **acqStore)
NS_IMETHOD CreateNewFileStore (nsIMdbEnv *ev, nsIMdbHeap *ioHeap, nsIMdbFile *ioFile, const mdbOpenPolicy *inOpenPolicy, nsIMdbStore **acqStore)
 morkFactory ()
 morkFactory (nsIMdbHeap *ioHeap)
 morkFactory (morkEnv *ev, const morkUsage &inUsage, nsIMdbHeap *ioHeap)
void CloseFactory (morkEnv *ev)
voidoperator new (size_t inSize) CPP_THROW_NEW
voidoperator new (size_t inSize, nsIMdbHeap &ioHeap, morkEnv *ev) CPP_THROW_NEW
mork_bool IsFactory () const
void NonFactoryTypeError (morkEnv *ev)
morkEnvGetInternalFactoryEnv (mdb_err *outErr)
mork_bool CanOpenMorkTextFile (morkEnv *ev, nsIMdbFile *ioFile)
NS_DECL_ISUPPORTS NS_IMETHOD IsFrozenMdbObject (nsIMdbEnv *ev, mdb_bool *outIsReadonly)
NS_IMETHOD GetMdbFactory (nsIMdbEnv *ev, nsIMdbFactory **acqFactory)
NS_IMETHOD GetWeakRefCount (nsIMdbEnv *ev, mdb_count *outCount)
NS_IMETHOD GetStrongRefCount (nsIMdbEnv *ev, mdb_count *outCount)
NS_IMETHOD AddWeakRef (nsIMdbEnv *ev)
mork_refs AddWeakRef (morkEnv *ev)
NS_IMETHOD AddStrongRef (nsIMdbEnv *ev)
virtual mork_refs AddStrongRef (morkEnv *ev)
NS_IMETHOD CutWeakRef (nsIMdbEnv *ev)
mork_refs CutWeakRef (morkEnv *ev)
NS_IMETHOD CutStrongRef (nsIMdbEnv *ev)
virtual mork_refs CutStrongRef (morkEnv *ev)
NS_IMETHOD CloseMdbObject (nsIMdbEnv *ev)
mdb_err CloseMdbObject (morkEnv *ev)
NS_IMETHOD IsOpenMdbObject (nsIMdbEnv *ev, mdb_bool *outOpen)
void CloseObject (morkEnv *ev)
mork_bool IsObject () const
mork_u4 BeadHash () const
mork_bool BeadEqual (const morkBead *inBead) const
void CloseBead (morkEnv *ev)
mork_bool IsBead () const
void SetFrozen ()
void SetMutable ()
void SetAsleep ()
mork_bool IsFrozen () const
mork_bool IsMutable () const
mork_bool IsAsleep () const
void SetNodeClean ()
void SetNodeDirty ()
mork_bool IsNodeClean () const
mork_bool IsNodeDirty () const
void ZapOld (morkEnv *ev, nsIMdbHeap *ioHeap)
void CloseNode (morkEnv *ev)
mork_bool IsNode () const
void RefsUnderUsesWarning (morkEnv *ev) const
void NonNodeError (morkEnv *ev) const
void NilHeapError (morkEnv *ev) const
void NonOpenNodeError (morkEnv *ev) const
void NonMutableNodeError (morkEnv *ev) const
void RefsOverflowWarning (morkEnv *ev) const
void UsesOverflowWarning (morkEnv *ev) const
void RefsUnderflowWarning (morkEnv *ev) const
void UsesUnderflowWarning (morkEnv *ev) const
mork_bool GoodRefs () const
mork_bool BadRefs () const
mork_uses StrongRefsOnly () const
mork_refs WeakRefsOnly () const
const char * GetNodeAccessAsString () const
const char * GetNodeUsageAsString () const
mork_usage NodeUsage () const
mork_bool IsHeapNode () const
mork_bool IsOpenNode () const
mork_bool IsShutNode () const
mork_bool IsDeadNode () const
mork_bool IsClosingNode () const
mork_bool IsOpenOrClosingNode () const
mork_bool HasNodeAccess () const
void MarkShut ()
void MarkClosing ()
void MarkDead ()

Static Public Member Functions

static void SlotWeakFactory (morkFactory *me, morkEnv *ev, morkFactory **ioSlot)
static void SlotStrongFactory (morkFactory *me, morkEnv *ev, morkFactory **ioSlot)
static void SlotWeakObject (morkObject *me, morkEnv *ev, morkObject **ioSlot)
static void SlotStrongObject (morkObject *me, morkEnv *ev, morkObject **ioSlot)
static void SlotWeakBead (morkBead *me, morkEnv *ev, morkBead **ioSlot)
static void SlotStrongBead (morkBead *me, morkEnv *ev, morkBead **ioSlot)
static voidMakeNew (size_t inSize, nsIMdbHeap &ioHeap, morkEnv *ev)
static void SlotWeakNode (morkNode *me, morkEnv *ev, morkNode **ioSlot)
static void SlotStrongNode (morkNode *me, morkEnv *ev, morkNode **ioSlot)

Public Attributes

morkEnv mFactory_Env
orkinHeap mFactory_Heap
morkHandlemObject_Handle
morkEnvmMorkEnv
mork_color mBead_Color
nsIMdbHeapmNode_Heap
mork_base mNode_Base
mork_derived mNode_Derived
mork_access mNode_Access
mork_usage mNode_Usage
mork_able mNode_Mutable
mork_load mNode_Load
mork_uses mNode_Uses
mork_refs mNode_Refs

Private Member Functions

 morkFactory (const morkFactory &other)
morkFactoryoperator= (const morkFactory &other)

Friends

class morkHandleFrame

Detailed Description

Definition at line 66 of file morkFactory.h.


Constructor & Destructor Documentation

Definition at line 98 of file morkFactory.cpp.

Here is the call graph for this function:

Definition at line 106 of file morkFactory.cpp.

Here is the call graph for this function:

Definition at line 120 of file morkFactory.cpp.

Here is the call graph for this function:

morkFactory::morkFactory ( morkEnv ev,
const morkUsage inUsage,
nsIMdbHeap ioHeap 
)

Definition at line 133 of file morkFactory.cpp.

Here is the call graph for this function:

morkFactory::morkFactory ( const morkFactory other) [private]

Member Function Documentation

NS_IMETHODIMP morkObject::AddStrongRef ( nsIMdbEnv ev) [virtual, inherited]

Implements nsIMdbObject.

Reimplemented in morkStore, and morkCursor.

Definition at line 181 of file morkObject.cpp.

{
  return morkNode::AddStrongRef((morkEnv *) mev);
}

Here is the caller graph for this function:

mork_uses morkNode::AddStrongRef ( morkEnv ev) [virtual, inherited]

Reimplemented in morkTable.

Definition at line 510 of file morkNode.cpp.

{
  mork_uses outUses = 0;
  if ( this )
  {
    if ( this->IsNode() )
    {
      mork_uses uses = mNode_Uses;
      mork_refs refs = mNode_Refs;
      if ( refs < uses ) // need to fix broken refs/uses relation?
      { 
        this->RefsUnderUsesWarning(ev);
        mNode_Refs = mNode_Uses = refs = uses;
      }
      if ( refs < morkNode_kMaxRefCount ) // not too great?
      {
        mNode_Refs = ++refs;
        mNode_Uses = ++uses;
      }
      else
        this->RefsOverflowWarning(ev);

      outUses = uses;
    }
    else
      this->NonNodeError(ev);
  }
  else
    ev->NilPointerError();
  return outUses;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP morkObject::AddWeakRef ( nsIMdbEnv ev) [virtual, inherited]

Implements nsIMdbObject.

Reimplemented in morkStore, and morkCursor.

Definition at line 176 of file morkObject.cpp.

{
  return morkNode::AddWeakRef((morkEnv *) mev);
}
mork_refs morkNode::AddWeakRef ( morkEnv ev) [inherited]

Definition at line 599 of file morkNode.cpp.

{
  mork_refs outRefs = 0;
  if ( this )
  {
    if ( this->IsNode() )
    {
      mork_refs refs = mNode_Refs;
      if ( refs < morkNode_kMaxRefCount ) // not too great?
        mNode_Refs = ++refs;
      else
        this->RefsOverflowWarning(ev);
        
      outRefs = refs;
    }
    else
      this->NonNodeError(ev);
  }
  else
    ev->NilPointerError();
  return outRefs;
}

Here is the call graph for this function:

Here is the caller graph for this function:

mork_bool morkNode::BadRefs ( ) const [inline, inherited]

Definition at line 217 of file morkNode.h.

{ return mNode_Refs < mNode_Uses; }
mork_bool morkBead::BeadEqual ( const morkBead inBead) const [inline, inherited]

Definition at line 88 of file morkBead.h.

  { return ( mBead_Color == inBead->mBead_Color); }

Here is the caller graph for this function:

mork_u4 morkBead::BeadHash ( ) const [inline, inherited]

Definition at line 87 of file morkBead.h.

{ return (mork_u4) mBead_Color; }

Here is the caller graph for this function:

NS_IMETHODIMP morkFactory::CanOpenFilePort ( nsIMdbEnv ev,
nsIMdbFile ioFile,
mdb_bool outCanOpen,
mdbYarn outFormatVersion 
) [virtual]

Implements nsIMdbFactory.

Definition at line 346 of file morkFactory.cpp.

{
  mdb_err outErr = 0;
  if ( outFormatVersion )
  {
    outFormatVersion->mYarn_Fill = 0;
  }
  mdb_bool canOpenAsPort = morkBool_kFalse;
  morkEnv* ev = morkEnv::FromMdbEnv(mev);
  if ( ev )
  {
    if ( ioFile && outCanOpen )
    {
      canOpenAsPort = this->CanOpenMorkTextFile(ev, ioFile);
    }
    else
      ev->NilPointerError();
    
    outErr = ev->AsErr();
  }
    
  if ( outCanOpen )
    *outCanOpen = canOpenAsPort;
    
  return outErr;
}

Here is the call graph for this function:

NS_IMETHODIMP morkFactory::CanOpenFileStore ( nsIMdbEnv ev,
nsIMdbFile ioFile,
mdb_bool outCanOpenAsStore,
mdb_bool outCanOpenAsPort,
mdbYarn outFormatVersion 
) [virtual]

Implements nsIMdbFactory.

Definition at line 486 of file morkFactory.cpp.

{
  mdb_bool canOpenAsStore = morkBool_kFalse;
  mdb_bool canOpenAsPort = morkBool_kFalse;
  if ( outFormatVersion )
  {
    outFormatVersion->mYarn_Fill = 0;
  }
  mdb_err outErr = 0;
  morkEnv* ev = morkEnv::FromMdbEnv(mev);
  if ( ev )
  {
    if ( ioFile && outCanOpenAsStore )
    {
      // right now always say true; later we should look for magic patterns
      canOpenAsStore = this->CanOpenMorkTextFile(ev, ioFile);
      canOpenAsPort = canOpenAsStore;
    }
    else
      ev->NilPointerError();
    
    outErr = ev->AsErr();
  }
  if ( outCanOpenAsStore )
    *outCanOpenAsStore = canOpenAsStore;
    
  if ( outCanOpenAsPort )
    *outCanOpenAsPort = canOpenAsPort;
    
  return outErr;
}

Here is the call graph for this function:

Definition at line 447 of file morkFactory.cpp.

{
  MORK_USED_1(ev);
  mork_bool outBool = morkBool_kFalse;
  mork_size headSize = MORK_STRLEN(morkWriter_kFileHeader);
  
  char localBuf[ 256 + 4 ]; // for extra for sloppy safety
  mdbYarn localYarn;
  mdbYarn* y = &localYarn;
  y->mYarn_Buf = localBuf; // space to hold content
  y->mYarn_Fill = 0;       // no logical content yet
  y->mYarn_Size = 256;     // physical capacity is 256 bytes
  y->mYarn_More = 0;
  y->mYarn_Form = 0;
  y->mYarn_Grow = 0;
  
  if ( ioFile )
  {
    nsIMdbEnv* menv = ev->AsMdbEnv();
    mdb_size actualSize = 0;
    ioFile->Get(menv, y->mYarn_Buf, y->mYarn_Size, /*pos*/ 0, &actualSize);
    y->mYarn_Fill = actualSize;
    
    if ( y->mYarn_Buf && actualSize >= headSize && ev->Good() )
    {
      mork_u1* buf = (mork_u1*) y->mYarn_Buf;
      outBool = ( MORK_MEMCMP(morkWriter_kFileHeader, buf, headSize) == 0 );
    }
  }
  else
    ev->NilPointerError();

  return outBool;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void morkBead::CloseBead ( morkEnv ev) [inherited]

Definition at line 109 of file morkBead.cpp.

{
  if ( this )
  {
    if ( this->IsNode() )
    {
      if ( !this->IsShutNode() )
      {
        mBead_Color = 0;
        this->MarkShut();
      }
    }
    else
      this->NonNodeError(ev);
  }
  else
    ev->NilPointerError();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 155 of file morkFactory.cpp.

{
  if ( this )
  {
    if ( this->IsNode() )
    {
      mFactory_Env.CloseMorkNode(ev);
      this->CloseObject(ev);
      this->MarkShut();
    }
    else
      this->NonNodeError(ev);
  }
  else
    ev->NilPointerError();
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP morkObject::CloseMdbObject ( nsIMdbEnv ev) [virtual, inherited]

Implements nsIMdbObject.

Reimplemented in morkStore, and morkCursor.

Definition at line 199 of file morkObject.cpp.

{
  return morkNode::CloseMdbObject((morkEnv *) mev);
}
mdb_err morkNode::CloseMdbObject ( morkEnv ev) [inherited]

Definition at line 243 of file morkNode.cpp.

{
  // if only one ref, Handle_CutStrongRef will clean up better.
  if (mNode_Uses == 1)
    return CutStrongRef(ev);

  mdb_err outErr = 0;
  
  if ( IsNode() && IsOpenNode() )
  {
    if ( ev )
    {
      CloseMorkNode(ev);
      outErr = ev->AsErr();
    }
  }
  return outErr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from morkObject.

Definition at line 87 of file morkFactory.cpp.

{
  if ( this->IsOpenNode() )
  {
    this->MarkClosing();
    this->CloseFactory(ev);
    this->MarkShut();
  }
}

Here is the call graph for this function:

void morkNode::CloseNode ( morkEnv ev) [inherited]

Definition at line 384 of file morkNode.cpp.

{
  if ( this )
  {
    if ( this->IsNode() )
      this->MarkShut();
    else
      this->NonNodeError(ev);
  }
  else
    ev->NilPointerError();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void morkObject::CloseObject ( morkEnv ev) [inherited]

Definition at line 119 of file morkObject.cpp.

{
  if ( this )
  {
    if ( this->IsNode() )
    {
      if ( !this->IsShutNode() )
      {
        if ( mObject_Handle )
          morkHandle::SlotWeakHandle((morkHandle*) 0L, ev, &mObject_Handle);
          
        mBead_Color = 0; // this->CloseBead(ev);
        this->MarkShut();
      }
    }
    else
      this->NonNodeError(ev);
  }
  else
    ev->NilPointerError();
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP morkFactory::CreateNewFile ( nsIMdbEnv ev,
nsIMdbHeap ioHeap,
const char *  inFilePath,
nsIMdbFile **  acqFile 
) [virtual]

Implements nsIMdbFactory.

Definition at line 234 of file morkFactory.cpp.

{
  mdb_err outErr = 0;
  morkEnv* ev = morkEnv::FromMdbEnv(mev);
  morkFile* file = nsnull;
  if ( ev )
  {
    if ( !ioHeap )
      ioHeap = &mFactory_Heap;
      
    file = morkFile::CreateNewFile(ev, ioHeap, inFilePath);
    if ( file )
      NS_ADDREF(file);
      
    outErr = ev->AsErr();
  }
  if ( acqFile )
    *acqFile = file;
    
  return outErr;
}

Here is the call graph for this function:

NS_IMETHODIMP morkFactory::CreateNewFileStore ( nsIMdbEnv ev,
nsIMdbHeap ioHeap,
nsIMdbFile ioFile,
const mdbOpenPolicy inOpenPolicy,
nsIMdbStore **  acqStore 
) [virtual]

Implements nsIMdbFactory.

Definition at line 610 of file morkFactory.cpp.

{
  mdb_err outErr = 0;
  nsIMdbStore* outStore = 0;
  morkEnv* ev = morkEnv::FromMdbEnv(mev);
  if ( ev )
  {
    if ( !ioHeap ) // need to use heap from env?
      ioHeap = ev->mEnv_Heap;
    
    if ( ioFile && inOpenPolicy && acqStore && ioHeap )
    {
      morkStore* store = new(*ioHeap, ev)
        morkStore(ev, morkUsage::kHeap, ioHeap, this, ioHeap);
        
      if ( store )
      {
        store->mStore_CanAutoAssignAtomIdentity = morkBool_kTrue;
        store->mStore_CanDirty = morkBool_kTrue;
        store->SetStoreAndAllSpacesCanDirty(ev, morkBool_kTrue);

        if ( store->CreateStoreFile(ev, ioFile, inOpenPolicy) )
          outStore = store;
        NS_ADDREF(store);          
      }
    }
    else
      ev->NilPointerError();
    
    outErr = ev->AsErr();
  }
  if ( acqStore )
    *acqStore = outStore;
  return outErr;
}

Here is the call graph for this function:

NS_IMETHODIMP morkObject::CutStrongRef ( nsIMdbEnv ev) [virtual, inherited]

Implements nsIMdbObject.

Reimplemented in morkStore, and morkCursor.

Definition at line 192 of file morkObject.cpp.

{
  return morkNode::CutStrongRef((morkEnv *) mev);
}

Here is the caller graph for this function:

mork_uses morkNode::CutStrongRef ( morkEnv ev) [virtual, inherited]

Reimplemented in morkTable.

Definition at line 580 of file morkNode.cpp.

{
  mork_refs outRefs = 0;
  if ( this )
  {
    if ( this->IsNode() )
    {
      if ( this->cut_use_count(ev) )
        outRefs = this->CutWeakRef(ev);
    }
    else
      this->NonNodeError(ev);
  }
  else
    ev->NilPointerError();
  return outRefs;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP morkObject::CutWeakRef ( nsIMdbEnv ev) [virtual, inherited]

Implements nsIMdbObject.

Reimplemented in morkStore, and morkCursor.

Definition at line 187 of file morkObject.cpp.

{
  return morkNode::CutWeakRef((morkEnv *) mev);
}

Here is the caller graph for this function:

mork_refs morkNode::CutWeakRef ( morkEnv ev) [inherited]

Definition at line 623 of file morkNode.cpp.

{
  mork_refs outRefs = 0;
  if ( this )
  {
    if ( this->IsNode() )
    {
      mork_uses uses = mNode_Uses;
      mork_refs refs = mNode_Refs;
      if ( refs ) // not yet zero?
        mNode_Refs = --refs;
      else
        this->RefsUnderflowWarning(ev);

      if ( refs < uses ) // need to fix broken refs/uses relation?
      { 
        this->RefsUnderUsesWarning(ev);
        mNode_Refs = mNode_Uses = refs = uses;
      }
        
      outRefs = refs;
      if ( !refs ) // last reference gone? time to destroy node?
        this->ZapOld(ev, mNode_Heap); // self destroy, use this no longer
    }
    else
      this->NonNodeError(ev);
  }
  else
    ev->NilPointerError();
  return outRefs;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 175 of file morkFactory.cpp.

{
  morkEnv* outEnv = 0;
  if (IsNode() && IsOpenNode() && IsFactory() )
  {
    morkEnv* fenv = &mFactory_Env;
    if ( fenv && fenv->IsNode() && fenv->IsOpenNode() && fenv->IsEnv() )
    {
      fenv->ClearMorkErrorsAndWarnings(); // drop any earlier errors
      outEnv = fenv;
    }
    else
      *outErr = morkEnv_kBadFactoryEnvError;
  }
  else
    *outErr = morkEnv_kBadFactoryError;
    
  return outEnv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP morkObject::GetMdbFactory ( nsIMdbEnv ev,
nsIMdbFactory **  acqFactory 
) [virtual, inherited]

Implements nsIMdbObject.

Definition at line 146 of file morkObject.cpp.

{
  nsresult rv;
  nsCOMPtr <nsIMdbObject> obj = do_QueryInterface(mev);
  if (obj)
    rv = obj->GetMdbFactory(mev, acqFactory);
  else
    return NS_ERROR_NO_INTERFACE;

  return rv;
} 

Here is the call graph for this function:

const char * morkNode::GetNodeAccessAsString ( ) const [inherited]

Definition at line 658 of file morkNode.cpp.

{
  const char* outString = morkNode_kBroken;
  switch( mNode_Access )
  {
    case morkAccess_kOpen: outString = "open"; break;
    case morkAccess_kClosing: outString = "closing"; break;
    case morkAccess_kShut: outString = "shut"; break;
    case morkAccess_kDead: outString = "dead"; break;
  }
  return outString;
}
const char * morkNode::GetNodeUsageAsString ( ) const [inherited]

Definition at line 672 of file morkNode.cpp.

{
  const char* outString = morkNode_kBroken;
  switch( mNode_Usage )
  {
    case morkUsage_kHeap: outString = "heap"; break;
    case morkUsage_kStack: outString = "stack"; break;
    case morkUsage_kMember: outString = "member"; break;
    case morkUsage_kGlobal: outString = "global"; break;
    case morkUsage_kPool: outString = "pool"; break;
    case morkUsage_kNone: outString = "none"; break;
  }
  return outString;
}
NS_IMETHODIMP morkObject::GetStrongRefCount ( nsIMdbEnv ev,
mdb_count outCount 
) [virtual, inherited]

Implements nsIMdbObject.

Reimplemented in morkStore, and morkCursor.

Definition at line 168 of file morkObject.cpp.

{
  *outCount = StrongRefsOnly();
  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP morkObject::GetWeakRefCount ( nsIMdbEnv ev,
mdb_count outCount 
) [virtual, inherited]

Implements nsIMdbObject.

Reimplemented in morkStore, and morkCursor.

Definition at line 161 of file morkObject.cpp.

{
  *outCount = WeakRefsOnly();
  return NS_OK;
}  

Here is the call graph for this function:

mork_bool morkNode::GoodRefs ( ) const [inline, inherited]

Definition at line 216 of file morkNode.h.

{ return mNode_Refs >= mNode_Uses; }
mork_bool morkNode::HasNodeAccess ( ) const [inline, inherited]

Definition at line 251 of file morkNode.h.

  { return ( IsOpenNode() || IsShutNode() || IsClosingNode() ); }

Here is the call graph for this function:

mork_bool morkNode::IsAsleep ( ) const [inline, inherited]

Definition at line 142 of file morkNode.h.

mork_bool morkBead::IsBead ( ) const [inline, inherited]

Definition at line 113 of file morkBead.h.

  { return IsNode() && mNode_Derived == morkDerived_kBead; }

Here is the call graph for this function:

mork_bool morkNode::IsClosingNode ( ) const [inline, inherited]

Definition at line 245 of file morkNode.h.

Here is the caller graph for this function:

mork_bool morkNode::IsDeadNode ( ) const [inline, inherited]

Definition at line 242 of file morkNode.h.

Here is the caller graph for this function:

mork_bool morkFactory::IsFactory ( ) const [inline]

Definition at line 217 of file morkFactory.h.

Here is the call graph for this function:

Here is the caller graph for this function:

mork_bool morkNode::IsFrozen ( ) const [inline, inherited]

Definition at line 140 of file morkNode.h.

Here is the caller graph for this function:

NS_IMETHODIMP morkObject::IsFrozenMdbObject ( nsIMdbEnv ev,
mdb_bool outIsReadonly 
) [virtual, inherited]

Implements nsIMdbObject.

Reimplemented in morkCursor.

Definition at line 211 of file morkObject.cpp.

{
  *outIsReadonly = IsFrozen();
  return NS_OK;
}

Here is the call graph for this function:

mork_bool morkNode::IsHeapNode ( ) const [inline, inherited]

Definition at line 233 of file morkNode.h.

  { return mNode_Usage == morkUsage_kHeap; }
mork_bool morkNode::IsMutable ( ) const [inline, inherited]

Definition at line 141 of file morkNode.h.

Here is the caller graph for this function:

mork_bool morkNode::IsNode ( ) const [inline, inherited]

Definition at line 193 of file morkNode.h.

  { return mNode_Base == morkBase_kNode; }
mork_bool morkNode::IsNodeClean ( ) const [inline, inherited]

Definition at line 147 of file morkNode.h.

{ return mNode_Load == morkLoad_kClean; }

Here is the caller graph for this function:

mork_bool morkNode::IsNodeDirty ( ) const [inline, inherited]

Definition at line 148 of file morkNode.h.

{ return mNode_Load == morkLoad_kDirty; }

Here is the caller graph for this function:

mork_bool morkObject::IsObject ( ) const [inline, inherited]

Definition at line 149 of file morkObject.h.

Here is the call graph for this function:

NS_IMETHODIMP morkObject::IsOpenMdbObject ( nsIMdbEnv ev,
mdb_bool outOpen 
) [virtual, inherited]

Implements nsIMdbObject.

Reimplemented in morkStore, and morkCursor.

Definition at line 205 of file morkObject.cpp.

{
  *outOpen = IsOpenNode();
  return NS_OK;
}

Here is the call graph for this function:

mork_bool morkNode::IsOpenNode ( ) const [inline, inherited]

Definition at line 236 of file morkNode.h.

mork_bool morkNode::IsOpenOrClosingNode ( ) const [inline, inherited]

Definition at line 248 of file morkNode.h.

  { return IsOpenNode() || IsClosingNode(); }

Here is the call graph for this function:

Here is the caller graph for this function:

mork_bool morkNode::IsShutNode ( ) const [inline, inherited]

Definition at line 239 of file morkNode.h.

Here is the caller graph for this function:

NS_IMETHODIMP morkFactory::MakeCompare ( nsIMdbEnv ev,
nsIMdbCompare **  acqCompare 
) [virtual]

Implements nsIMdbFactory.

Definition at line 326 of file morkFactory.cpp.

{
  NS_ASSERTION(PR_FALSE, "not implemented");
  return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP morkFactory::MakeEnv ( nsIMdbHeap ioHeap,
nsIMdbEnv **  acqEnv 
) [virtual]

Implements nsIMdbFactory.

Definition at line 266 of file morkFactory.cpp.

{
  mdb_err outErr = 0;
  nsIMdbEnv* outEnv = 0;
  mork_bool ownsHeap = (ioHeap == 0);
  if ( !ioHeap )
    ioHeap = new orkinHeap();

  if ( acqEnv && ioHeap )
  {
    morkEnv* fenv = this->GetInternalFactoryEnv(&outErr);
    if ( fenv )
    {
      morkEnv* newEnv = new(*ioHeap, fenv)
        morkEnv(morkUsage::kHeap, ioHeap, this, ioHeap);

      if ( newEnv )
      {
        newEnv->mEnv_OwnsHeap = ownsHeap;
        newEnv->mNode_Refs += morkEnv_kWeakRefCountEnvBonus;
        NS_ADDREF(newEnv);
        newEnv->mEnv_SelfAsMdbEnv = newEnv;
        outEnv = newEnv;
      }
      else
        outErr = morkEnv_kOutOfMemoryError;
    }
    
    *acqEnv = outEnv;
  }
  else
    outErr = morkEnv_kNilPointerError;
    
  return outErr;
}

Here is the call graph for this function:

NS_IMETHODIMP morkFactory::MakeHeap ( nsIMdbEnv ev,
nsIMdbHeap **  acqHeap 
) [virtual]

Implements nsIMdbFactory.

Definition at line 306 of file morkFactory.cpp.

{
  mdb_err outErr = 0;
  nsIMdbHeap* outHeap = 0;
  morkEnv* ev = morkEnv::FromMdbEnv(mev);
  if ( ev )
  {
    outHeap = new orkinHeap();
    if ( !outHeap )
      ev->OutOfMemoryError();
  }
  MORK_ASSERT(acqHeap);
  if ( acqHeap )
    *acqHeap = outHeap;
  return outErr;
}

Here is the call graph for this function:

void * morkNode::MakeNew ( size_t  inSize,
nsIMdbHeap ioHeap,
morkEnv ev 
) [static, inherited]

Definition at line 177 of file morkNode.cpp.

{
  void* node = 0;
  if ( &ioHeap )
  {
    ioHeap.Alloc(ev->AsMdbEnv(), inSize, (void **) &node);
    if ( !node )
      ev->OutOfMemoryError();
  }
  else
    ev->NilPointerError();
  
  return node;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP morkFactory::MakeRow ( nsIMdbEnv ev,
nsIMdbHeap ioHeap,
nsIMdbRow **  acqRow 
) [virtual]

Implements nsIMdbFactory.

Definition at line 335 of file morkFactory.cpp.

{
  NS_ASSERTION(PR_FALSE, "not implemented");
  return NS_ERROR_NOT_IMPLEMENTED;
}
void morkNode::MarkClosing ( ) [inline, inherited]

Definition at line 255 of file morkNode.h.

void morkNode::MarkDead ( ) [inline, inherited]

Definition at line 256 of file morkNode.h.

void morkNode::MarkShut ( ) [inline, inherited]

Definition at line 254 of file morkNode.h.

void morkNode::NilHeapError ( morkEnv ev) const [inherited]

Definition at line 354 of file morkNode.cpp.

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

Here is the caller graph for this function:

mork_usage morkNode::NodeUsage ( ) const [inline, inherited]

Definition at line 231 of file morkNode.h.

{ return mNode_Usage; }

Definition at line 197 of file morkFactory.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

void morkNode::NonMutableNodeError ( morkEnv ev) const [inherited]

Definition at line 348 of file morkNode.cpp.

{
  ev->NewError("non-mutable-morkNode");
}

Here is the caller graph for this function:

void morkNode::NonNodeError ( morkEnv ev) const [inherited]

Definition at line 336 of file morkNode.cpp.

{
  ev->NewError("non-morkNode");
}
void morkNode::NonOpenNodeError ( morkEnv ev) const [inherited]

Definition at line 342 of file morkNode.cpp.

{
  ev->NewError("non-open-morkNode");
}

Here is the caller graph for this function:

NS_IMETHODIMP morkFactory::OpenFilePort ( nsIMdbEnv ev,
nsIMdbHeap ioHeap,
nsIMdbFile ioFile,
const mdbOpenPolicy inOpenPolicy,
nsIMdbThumb **  acqThumb 
) [virtual]

Implements nsIMdbFactory.

Definition at line 380 of file morkFactory.cpp.

{
  NS_ASSERTION(PR_FALSE, "this doesn't look implemented");
  MORK_USED_1(ioHeap);
  mdb_err outErr = 0;
  nsIMdbThumb* outThumb = 0;
  morkEnv* ev = morkEnv::FromMdbEnv(mev);
   if ( ev )
  {
    if ( ioFile && inOpenPolicy && acqThumb )
    {
    }
    else
      ev->NilPointerError();
    
    outErr = ev->AsErr();
  }
  if ( acqThumb )
    *acqThumb = outThumb;
  return outErr;
}

Here is the call graph for this function:

NS_IMETHODIMP morkFactory::OpenFileStore ( nsIMdbEnv ev,
nsIMdbHeap ioHeap,
nsIMdbFile ioFile,
const mdbOpenPolicy inOpenPolicy,
nsIMdbThumb **  acqThumb 
) [virtual]

Implements nsIMdbFactory.

Definition at line 526 of file morkFactory.cpp.

{
  mdb_err outErr = 0;
  nsIMdbThumb* outThumb = 0;
  morkEnv* ev = morkEnv::FromMdbEnv(mev);
  if ( ev )
  {
    if ( !ioHeap ) // need to use heap from env?
      ioHeap = ev->mEnv_Heap;
    
    if ( ioFile && inOpenPolicy && acqThumb )
    {
      morkStore* store = new(*ioHeap, ev)
        morkStore(ev, morkUsage::kHeap, ioHeap, this, ioHeap);
        
      if ( store )
      {
        mork_bool frozen = morkBool_kFalse; // open store mutable access
        if ( store->OpenStoreFile(ev, frozen, ioFile, inOpenPolicy) )
        {
          morkThumb* thumb = morkThumb::Make_OpenFileStore(ev, ioHeap, store);
          if ( thumb )
          {
            outThumb = thumb;
            thumb->AddRef();
          }
        }
//        store->CutStrongRef(mev); // always cut ref (handle has its own ref)
      }
    }
    else
      ev->NilPointerError();
    
    outErr = ev->AsErr();
  }
  if ( acqThumb )
    *acqThumb = outThumb;
  return outErr;
}

Here is the call graph for this function:

NS_IMETHODIMP morkFactory::OpenOldFile ( nsIMdbEnv ev,
nsIMdbHeap ioHeap,
const char *  inFilePath,
mdb_bool  inFrozen,
nsIMdbFile **  acqFile 
) [virtual]

Implements nsIMdbFactory.

Definition at line 204 of file morkFactory.cpp.

{
  mdb_err outErr = 0;
  morkEnv* ev = morkEnv::FromMdbEnv(mev);
  morkFile* file = nsnull;
  if ( ev )
  {
    if ( !ioHeap )
      ioHeap = &mFactory_Heap;
      
    file = morkFile::OpenOldFile(ev, ioHeap, inFilePath, inFrozen);
    NS_IF_ADDREF( file );
      
    outErr = ev->AsErr();
  }
  if ( acqFile )
    *acqFile = file;
    
  return outErr;
}

Here is the call graph for this function:

void* morkFactory::operator new ( size_t  inSize) [inline]

Definition at line 206 of file morkFactory.h.

  { return ::operator new(inSize); }
void* morkFactory::operator new ( size_t  inSize,
nsIMdbHeap ioHeap,
morkEnv ev 
) [inline]

Reimplemented from morkNode.

Definition at line 209 of file morkFactory.h.

  { return morkNode::MakeNew(inSize, ioHeap, ev); }

Here is the call graph for this function:

morkFactory& morkFactory::operator= ( const morkFactory other) [private]
void morkNode::RefsOverflowWarning ( morkEnv ev) const [inherited]

Definition at line 360 of file morkNode.cpp.

{
  ev->NewWarning("mNode_Refs overflow");
}

Here is the caller graph for this function:

void morkNode::RefsUnderflowWarning ( morkEnv ev) const [inherited]

Definition at line 372 of file morkNode.cpp.

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

Here is the caller graph for this function:

void morkNode::RefsUnderUsesWarning ( morkEnv ev) const [inherited]

Definition at line 330 of file morkNode.cpp.

{
  ev->NewError("mNode_Refs < mNode_Uses");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void morkNode::SetAsleep ( ) [inline, inherited]

Definition at line 138 of file morkNode.h.

void morkNode::SetFrozen ( ) [inline, inherited]

Definition at line 136 of file morkNode.h.

void morkNode::SetMutable ( ) [inline, inherited]

Definition at line 137 of file morkNode.h.

void morkNode::SetNodeClean ( ) [inline, inherited]

Definition at line 144 of file morkNode.h.

Here is the caller graph for this function:

void morkNode::SetNodeDirty ( ) [inline, inherited]

Definition at line 145 of file morkNode.h.

Here is the caller graph for this function:

static void morkBead::SlotStrongBead ( morkBead me,
morkEnv ev,
morkBead **  ioSlot 
) [inline, static, inherited]

Definition at line 124 of file morkBead.h.

  { morkNode::SlotStrongNode((morkNode*) me, ev, (morkNode**) ioSlot); }

Here is the call graph for this function:

static void morkFactory::SlotStrongFactory ( morkFactory me,
morkEnv ev,
morkFactory **  ioSlot 
) [inline, static]

Definition at line 232 of file morkFactory.h.

  { morkNode::SlotStrongNode((morkNode*) me, ev, (morkNode**) ioSlot); }

Here is the call graph for this function:

void morkNode::SlotStrongNode ( morkNode me,
morkEnv ev,
morkNode **  ioSlot 
) [static, inherited]

Definition at line 466 of file morkNode.cpp.

{
  morkNode* node = *ioSlot;
  if ( me != node )
  {
    if ( node )
    {
      // what if this nulls out the ev and causes asserts?
      // can we move this after the CutStrongRef()?
      *ioSlot = 0;
      node->CutStrongRef(ev);
    }
    if ( me && me->AddStrongRef(ev) )
      *ioSlot = me;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void morkObject::SlotStrongObject ( morkObject me,
morkEnv ev,
morkObject **  ioSlot 
) [inline, static, inherited]

Definition at line 160 of file morkObject.h.

  { morkNode::SlotStrongNode((morkNode*) me, ev, (morkNode**) ioSlot); }

Here is the call graph for this function:

Here is the caller graph for this function:

static void morkBead::SlotWeakBead ( morkBead me,
morkEnv ev,
morkBead **  ioSlot 
) [inline, static, inherited]

Definition at line 120 of file morkBead.h.

  { morkNode::SlotWeakNode((morkNode*) me, ev, (morkNode**) ioSlot); }

Here is the call graph for this function:

static void morkFactory::SlotWeakFactory ( morkFactory me,
morkEnv ev,
morkFactory **  ioSlot 
) [inline, static]

Definition at line 228 of file morkFactory.h.

  { morkNode::SlotWeakNode((morkNode*) me, ev, (morkNode**) ioSlot); }

Here is the call graph for this function:

Here is the caller graph for this function:

void morkNode::SlotWeakNode ( morkNode me,
morkEnv ev,
morkNode **  ioSlot 
) [static, inherited]

Definition at line 489 of file morkNode.cpp.

{
  morkNode* node = *ioSlot;
  if ( me != node )
  {
    if ( node )
    {
      *ioSlot = 0;
      node->CutWeakRef(ev);
    }
    if ( me && me->AddWeakRef(ev) )
      *ioSlot = me;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void morkObject::SlotWeakObject ( morkObject me,
morkEnv ev,
morkObject **  ioSlot 
) [inline, static, inherited]

Definition at line 156 of file morkObject.h.

  { morkNode::SlotWeakNode((morkNode*) me, ev, (morkNode**) ioSlot); }

Here is the call graph for this function:

mork_uses morkNode::StrongRefsOnly ( ) const [inline, inherited]

Definition at line 219 of file morkNode.h.

{ return mNode_Uses; }

Here is the caller graph for this function:

NS_IMETHODIMP morkFactory::ThumbToOpenPort ( nsIMdbEnv ev,
nsIMdbThumb ioThumb,
nsIMdbPort **  acqPort 
) [virtual]

Implements nsIMdbFactory.

Definition at line 411 of file morkFactory.cpp.

{
  mdb_err outErr = 0;
  nsIMdbPort* outPort = 0;
  morkEnv* ev = morkEnv::FromMdbEnv(mev);
  if ( ev )
  {
    if ( ioThumb && acqPort )
    {
      morkThumb* thumb = (morkThumb*) ioThumb;
      morkStore* store = thumb->ThumbToOpenStore(ev);
      if ( store )
      {
        store->mStore_CanAutoAssignAtomIdentity = morkBool_kTrue;
        store->mStore_CanDirty = morkBool_kTrue;
        store->SetStoreAndAllSpacesCanDirty(ev, morkBool_kTrue);
        
        NS_ADDREF(store);
        outPort = store;
      }
    }
    else
      ev->NilPointerError();
    
    outErr = ev->AsErr();
  }
  if ( acqPort )
    *acqPort = outPort;
  return outErr;
}

Here is the call graph for this function:

NS_IMETHODIMP morkFactory::ThumbToOpenStore ( nsIMdbEnv ev,
nsIMdbThumb ioThumb,
nsIMdbStore **  acqStore 
) [virtual]

Implements nsIMdbFactory.

Definition at line 575 of file morkFactory.cpp.

{
  mdb_err outErr = 0;
  nsIMdbStore* outStore = 0;
  morkEnv* ev = morkEnv::FromMdbEnv(mev);
  if ( ev )
  {
    if ( ioThumb && acqStore )
    {
      morkThumb* thumb = (morkThumb*) ioThumb;
      morkStore* store = thumb->ThumbToOpenStore(ev);
      if ( store )
      {
        store->mStore_CanAutoAssignAtomIdentity = morkBool_kTrue;
        store->mStore_CanDirty = morkBool_kTrue;
        store->SetStoreAndAllSpacesCanDirty(ev, morkBool_kTrue);
        
        outStore = store;
        NS_ADDREF(store);
      }
    }
    else
      ev->NilPointerError();
    
    outErr = ev->AsErr();
  }
  if ( acqStore )
    *acqStore = outStore;
  return outErr;
}

Here is the call graph for this function:

void morkNode::UsesOverflowWarning ( morkEnv ev) const [inherited]

Definition at line 366 of file morkNode.cpp.

{
  ev->NewWarning("mNode_Uses overflow");
}
void morkNode::UsesUnderflowWarning ( morkEnv ev) const [inherited]

Definition at line 378 of file morkNode.cpp.

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

Here is the caller graph for this function:

mork_refs morkNode::WeakRefsOnly ( ) const [inline, inherited]

Definition at line 220 of file morkNode.h.

{ return (mork_refs) ( mNode_Refs - mNode_Uses ); }

Here is the caller graph for this function:

void morkNode::ZapOld ( morkEnv ev,
nsIMdbHeap ioHeap 
) [inherited]

Definition at line 193 of file morkNode.cpp.

{
  if ( this )
  {
    if ( this->IsNode() )
    {
      mork_usage usage = mNode_Usage; // mNode_Usage before ~morkNode
      this->morkNode::~morkNode(); // first call polymorphic destructor
      if ( ioHeap ) // was this node heap allocated?
        ioHeap->Free(ev->AsMdbEnv(), this);
      else if ( usage == morkUsage_kPool ) // mNode_Usage before ~morkNode
      {
        morkHandle* h = (morkHandle*) this;
        if ( h->IsHandle() && h->GoodHandleTag() )
        {
          if ( h->mHandle_Face )
          {
            if (ev->mEnv_HandlePool)
              ev->mEnv_HandlePool->ZapHandle(ev, h->mHandle_Face);
            else if (h->mHandle_Env && h->mHandle_Env->mEnv_HandlePool)
              h->mHandle_Env->mEnv_HandlePool->ZapHandle(ev, h->mHandle_Face);
          }
          else
            ev->NilPointerError();
        }
      }
    }
    else
      this->NonNodeError(ev);
  }
  else
    ev->NilPointerError();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class morkHandleFrame [friend, inherited]

Reimplemented in morkHandle.

Definition at line 131 of file morkNode.h.


Member Data Documentation

Definition at line 83 of file morkBead.h.

Definition at line 84 of file morkFactory.h.

Definition at line 85 of file morkFactory.h.

Definition at line 91 of file morkObject.h.

Definition at line 122 of file morkNode.h.

Definition at line 119 of file morkNode.h.

Definition at line 120 of file morkNode.h.

Definition at line 117 of file morkNode.h.

Definition at line 125 of file morkNode.h.

Definition at line 124 of file morkNode.h.

Definition at line 128 of file morkNode.h.

Definition at line 123 of file morkNode.h.

Definition at line 127 of file morkNode.h.

Definition at line 89 of file morkObject.h.


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