home *** CD-ROM | disk | FTP | other *** search
- #ifndef __RWVREF_H__
- #define __RWVREF_H__
- pragma push_align_members(64);
-
- /*
- * RWVirtualRef: Reference counted virtual array reference.
- *
- * $Header: E:/vcs/rw/vref.h_v 1.0 11 Mar 1992 14:10:00 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/vref.h_v $
- *
- * Rev 1.0 11 Mar 1992 14:10:00 KEFFER
- * Initial revision.
- */
-
- #ifndef __RWREF_H__
- # include "rw/ref.h"
- #endif
- #include "rw/vpage.h"
- STARTWRAP
- #include <stdlib.h>
- ENDWRAP
-
- typedef unsigned RWPageSlot;
-
- class RWExport RWVirtualRef : public RWReference {
-
- public:
-
- RWVirtualRef(long length, size_t elementSize, RWVirtualPageHeap* h);
- RWVirtualRef(const RWVirtualRef&); // Deep copy
- ~RWVirtualRef();
-
- long capacity() const {return _nSlots*_nPerPage;}
- RWVirtualPageHeap* heap() const {return _myHeap;}
- long length() const {return _length;}
- void slide(long start, long delta);
- void setSlice(long start1, long extent1,
- RWVirtualRef& v, long start2, long extent2);
- void reshape(long newLength);
-
- // The following three functions are formally intended to be
- // protected, but a bug in Borland C++ requires that they be public.
- #ifdef __TURBOC__
- public:
- #else
- protected:
- #endif
-
- void findLocation(long, RWPageSlot&, unsigned&) const;
- void* lock(RWPageSlot p) {return _myHeap->lock(_handles[p]);}
- void unlock(RWPageSlot p) {_myHeap->unlock(_handles[p]);}
-
- protected:
-
- // Neither augmentLeft nor augmentRight change the vector length.
- // They just add capacity to one side or the other.
- void augmentLeft(long); // Add capacity on left
- void augmentRight(long); // Add capacity on right
- unsigned pages() {return _nSlots;}
- unsigned pageSize() {return _myHeap->pageSize();}
- void dirty(RWPageSlot p) {_myHeap->dirty(_handles[p]);}
-
- // Supplied by specializing class:
- virtual void conformalCopy(long start1, RWVirtualRef& v2, long start2, long N) = 0;
-
- protected:
-
- // Protected data.
- // Note that the length of the vector _handles is _nSlots.
-
- long _length; // Total number of elements
- long _baseIndex; // Start of actual data
- unsigned _nPerPage; // Number of elements per page
- RWVirtualPageHeap* _myHeap; // The heap I'm getting my pages from
- RWHandle* _handles; // Array of handles
- RWPageSlot _nSlots; // Length of _handles.
-
- };
-
- pragma pop_align_members();
- #endif /* __RWVREF_H__ */
-