/********************************************************************** * * XRFFile.h * Copyright (C) 2003 UNESCO * * A component of the Greenstone digital library software * from the New Zealand Digital Library Project at the * University of Waikato, New Zealand. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *********************************************************************/ //////////////////////////////////////////////////////////// // XRFFILE.H : Cross Ref File object // //////////////////////////////////////////////////////////// #ifndef _XRFFILE_H_ #define _XRFFILE_H_ #ifndef _BLKFILE_H_ #include "blkfile.h" #endif #include #include "IErrors.h" const int MAXTIV = 127; // # of XRF entries per block const int XRFBLKSIZE = 512; // const int MAXMFB = 1048576; ///////////////////////////////////////// // Cross reference file data structures // struct MSTA_ENTRY // Unpacked MST address { long xrfmfb_; // Master file block short int xrfmfp_; // Offset } ; struct XRFA // To strore unpacked addresses { long xrfpos_; // Block number on xrf_ file or -1 if empty short int xrfeof_; // 1 if last block of xrf_ file MSTA_ENTRY xrftiv_[MAXTIV]; // MAXTIV unpacked MST addresses XRFA() { Init(); } void Init() { xrfeof_ = 0; // Not eof xrfpos_ = -1; // empty for (int i=0; i0); ReadBlk(xrf_, b); UnPack(); } ////////////////////////////// inline void XrfFile::WriteXrf(long b) // Writes the content of xrf_ buffer as block number b { assert(b>0); Pack(); WriteBlk(xrf_, b); } #endif