////////////////////////////////////////////////////////////////////////// InitNewBlock //////////////////////////////////////////////////////////////////////////
| 93 | // InitNewBlock |
| 94 | /////////////////////////////////////////////////////////////////////////////// |
| 95 | void cBlockRecordArray::InitNewBlock() //throw (eArchive) |
| 96 | { |
| 97 | ASSERT(mpBlockFile != 0); |
| 98 | ASSERT((mBlockNum >= 0) && (mBlockNum < mpBlockFile->GetNumBlocks())); |
| 99 | #ifdef _BLOCKFILE_DEBUG |
| 100 | mpBlockFile->AssertValid(); |
| 101 | #endif |
| 102 | |
| 103 | cBlockFile::Block* pBlock = mpBlockFile->GetBlock(mBlockNum); |
| 104 | tIndexArray& array = util_GetIndexArray(pBlock); |
| 105 | // |
| 106 | // set everything to zero.. |
| 107 | // |
| 108 | memset(pBlock->GetData(), 0, cBlockFile::BLOCK_SIZE); |
| 109 | pBlock->SetDirty(); |
| 110 | // |
| 111 | // set up the guard byte for the index array... |
| 112 | // |
| 113 | array.maRecordIndex[0].SetOffset(-1); |
| 114 | array.maRecordIndex[0].SetMainIndex(INVALID_INDEX); |
| 115 | // |
| 116 | // remember that we have been initialized |
| 117 | // |
| 118 | mbInit = true; |
| 119 | // |
| 120 | // update the free space and max index variables... |
| 121 | // |
| 122 | mNumItems = 0; |
| 123 | UpdateFreeSpace(pBlock); |
| 124 | WriteHeaderInfo(pBlock); |
| 125 | } |
| 126 | |
| 127 | /////////////////////////////////////////////////////////////////////////////// |
| 128 | // InitForExistingBlock |