home *** CD-ROM | disk | FTP | other *** search
- #ifndef __RWDISKPAGE_H__
- #define __RWDISKPAGE_H__
- pragma push_align_members(64);
-
- /*
- * RWDiskPageHeap: Specializing buffered page heap that swaps pages out to disk.
- *
- * $Header: E:/vcs/rw/diskpage.h_v 1.0 11 Mar 1992 14:09:58 KEFFER $
- *
- ****************************************************************************
- *
- * Rogue Wave Software, Inc.
- * P.O. Box 2328
- * Corvallis, OR 97339
- *
- * Copyright (C) 1992. This software is subject to copyright
- * protection under the laws of the United States and other countries.
- *
- ***************************************************************************
- *
- * $Log: E:/vcs/rw/diskpage.h_v $
- *
- * Rev 1.0 11 Mar 1992 14:09:58 KEFFER
- * Initial revision.
- */
-
- #include "rw/bufpage.h"
- #include "rw/bitvec.h"
- STARTWRAP
- #include <stdio.h>
- ENDWRAP
-
- class RWExport RWDiskPageHeap : public RWBufferedPageHeap {
-
- public:
-
- RWDiskPageHeap(const char* filename=0, unsigned nbufs=10, unsigned pgsize=512);
- virtual ~RWDiskPageHeap();
-
- RWBoolean isValid() const {return _tempfp!=0;}
-
- // Inherited from RWPageBuffer:
- virtual RWHandle allocate();
- virtual void deallocate(RWHandle);
-
- protected:
-
- enum HandleStatus { NotUsed, NoSwapSpace, HasSwapSpace };
-
- RWBoolean allocateDiskPage(RWHandle);
- RWBoolean handleValid(RWHandle);
- RWoffset offsetOfHandle(RWHandle);
- void resize(unsigned);
-
- // Inherited from RWBufferedPageHeap:
- virtual RWBoolean swapIn(RWHandle, void*);
- virtual RWBoolean swapOut(RWHandle, void*);
-
- private:
-
- static const unsigned _initialPages;
- static const unsigned _initialHandles;
- static const unsigned _pageIncrement;
- static const unsigned _handleIncrement;
- RWBitVec _freePageMap; // Bit flags for free disk pages
- unsigned* _handleMap; // Array that maps from handle number to disk page
- HandleStatus* _handleStatus; // Status of each slot in _handleMap
- unsigned _nHandles; // Length of _handleMap and _handleStatus
- FILE* _tempfp;
-
- };
-
- pragma pop_align_members();
- #endif /* __RWDISKPAGE_H__ */
-