Description | Hierarchy | Fields | Methods | Properties |
type unaMappedMemory = class(unaObject)
This is wrapper class for the Windows mapped memory mechanism.
constructor create(const name: wString; size64: int64 = 0; access: DWORD = PAGE_READWRITE; doOpen: bool = true; canCreate: bool = true); |
|
function flush(): bool; |
|
function mapHeader(size: int = -1): pointer; |
|
function mapView(offset: int64; reqSize: unsigned; out subOfs: int): pointer; |
|
function mapViewAll(): pointer; |
|
function open(access: DWORD = PAGE_READWRITE): bool; |
|
function read(offs: int64; buf: pointer; sz: unsigned): unsigned; |
|
function unmapView(baseAddr: pointer): bool; |
|
function write(offs: int64; buf: pointer; sz: unsigned): unsigned; |
|
function open2(access: DWORD = PAGE_READWRITE): bool; virtual; |
|
procedure AfterConstruction(); override; |
|
procedure BeforeDestruction(); override; |
|
procedure close(); |
|
procedure close2(); virtual; |
|
procedure doSetNewSize(newValue: int64); virtual; |
property allocGran: unsigned read f_allocGran; |
|
property handle: tHandle read f_handle; |
|
property size64: int64 read f_size64 write setSize; |
constructor create(const name: wString; size64: int64 = 0; access: DWORD = PAGE_READWRITE; doOpen: bool = true; canCreate: bool = true); |
|
function flush(): bool; |
|
Flushes any pending data from memory. |
function mapHeader(size: int = -1): pointer; |
|
Maps <size> bytes at offset 0 (allocGran bytes if size = -1, default) |
function mapView(offset: int64; reqSize: unsigned; out subOfs: int): pointer; |
|
Maps portion of memory to buffer. Because memory is allocated by pages and because returned pointer is later used in unmapView(), it is not always possible to return pointer to data at requested offset. Instead function returns nearest pointer and sub-offset, which should be added to this pointer to get data exactly at requested offset. NOTE: If allocGran is a divisor of specied offset, subOfs will always be zero.
Parameters
ReturnsNearest possible pointer to data at specified offset. |
function mapViewAll(): pointer; |
|
Tries to map the whole memory to buffer. Could fail on large data. |
function open(access: DWORD = PAGE_READWRITE): bool; |
|
function read(offs: int64; buf: pointer; sz: unsigned): unsigned; |
|
Reads data from mapped memory at specified offset. |
function unmapView(baseAddr: pointer): bool; |
|
Unmaps memory previously mapped by mapView() |
function write(offs: int64; buf: pointer; sz: unsigned): unsigned; |
|
Writes data to mapped memory at specified offset. |
function open2(access: DWORD = PAGE_READWRITE): bool; virtual; |
|
procedure AfterConstruction(); override; |
|
procedure BeforeDestruction(); override; |
|
procedure close(); |
|
procedure close2(); virtual; |
|
procedure doSetNewSize(newValue: int64); virtual; |
|
property allocGran: unsigned read f_allocGran; |
|
Allocation grain. All offsets should be aligned to this value for optimal performace. |
property handle: tHandle read f_handle; |
|
Handle of mapped memory. |
property size64: int64 read f_size64 write setSize; |
|
Size of mapped memory. |
(c) 2012 Lake of Soft