BTree::BTree(PageDB::Scheduler* _pgdb, const std::string& fn) : pgdb(_pgdb), file(pgdb->OpenFile(fn)), entrySession(pgdb->GetWriteSession(file, file->entryPageID)) { if (magicNumber() != MagicNumber) { initBTree(); } }
void BTree::initBTree() { magicNumber() = MagicNumber; int rtPage = file->newPage(); int infoPage = file->newPage(); file->eof.Page = infoPage; file->eof.Offset = sizeof(Information); file->writebackFileHeaderCore(); rootPage() = rtPage; usedRecord() = 0; avalibleRecord() = 0; linkHeadPage() = infoPage; linkHeadOffset() = 0; PageDB::PageWriteSession s = pgdb->GetWriteSession(file, infoPage); Information* info = reinterpret_cast<Information*>(s.buf()); info->next = info->prev = PageDB::Location(infoPage, 0); entrySession.flush(); }
#include "Kirana.h" /****************************************************************************** * Function: Kirana * Inputs: * Returns: * Description: Default constructor ******************************************************************************/ Kirana::Kirana(std::string fileNameParam="K:\Kirana Videos\2018\180215\KirImage_0001.SVF"): magicNumber(0), // magic Number to read at begining ("SVF") imageNum(0), // number of images imageWidth(0), // width of image in pixels imageHeight(0), // height of image in pixels frameZeroSize(0), // Size of frame 0 frameZeroOffset(0), // Frame 0 offset headerSize(0), // size of header in bytes metaDataSize(0), // size of meta data block (images) imageInfoSize(0), // size of image info structure imageSeqSize(0), // Size of image sequence offsetBytes(0), // number of bytes offset for the file setupDataSize(0), // Size of xml setup block versionNum(0), // Version number cropRowLow(0), // The crop row value on the bottom cropRowHigh(0), // The crop row value in the top cropColHigh(0), // The crop value on the far right cropColLow(0), // The crop value on the far left metaData(0), // Offset of meta data block setupData(0), // Offset of xml setup block imageInfo(0), // Offset of image info structure