31 #ifndef CPL_VIRTUAL_MEM_INCLUDED 32 #define CPL_VIRTUAL_MEM_INCLUDED 92 const void* pPageToBeEvicted,
169 size_t nPageSizeHint,
170 int bSingleThreadUsage,
215 void *pCbkUserData );
376 void* pAddr,
size_t nSize,
int bWriteOp);
size_t CPLVirtualMemGetPageSize(CPLVirtualMem *ctxt)
Return the page size associated to a virtual memory mapping.
Definition: cpl_virtualmem.cpp:2224
Core portability definitions for CPL.
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:337
FILE VSILFILE
Opaque type for a FILE that implements the VSIVirtualHandle API.
Definition: cpl_vsi.h:156
void CPLVirtualMemUnDeclareThread(CPLVirtualMem *ctxt)
Declare that a thread will stop accessing a virtual memory mapping.
Definition: cpl_virtualmem.cpp:1979
void(* CPLVirtualMemUnCachePageCbk)(CPLVirtualMem *ctxt, size_t nOffset, const void *pPageToBeEvicted, size_t nToBeEvicted, void *pUserData)
Callback triggered when a dirty mapped page is going to be freed.
Definition: cpl_virtualmem.h:90
struct CPLVirtualMem CPLVirtualMem
Opaque type that represents a virtual memory mapping.
Definition: cpl_virtualmem.h:62
void CPLVirtualMemManagerTerminate(void)
Cleanup any resource and handlers related to virtual memory.
Definition: cpl_virtualmem.cpp:1987
int CPLVirtualMemIsFileMapping(CPLVirtualMem *ctxt)
Return if the virtual memory mapping is a direct file mapping.
Definition: cpl_virtualmem.cpp:2206
Definition: cpl_virtualmem.h:106
void(* CPLVirtualMemCachePageCbk)(CPLVirtualMem *ctxt, size_t nOffset, void *pPageToFill, size_t nToFill, void *pUserData)
Callback triggered when a still unmapped page of virtual memory is accessed.
Definition: cpl_virtualmem.h:74
void(* CPLVirtualMemFreeUserData)(void *pUserData)
Callback triggered when a virtual memory mapping is destroyed.
Definition: cpl_virtualmem.h:99
CPLVirtualMem * CPLVirtualMemDerivedNew(CPLVirtualMem *pVMemBase, vsi_l_offset nOffset, vsi_l_offset nSize, CPLVirtualMemFreeUserData pfnFreeUserData, void *pCbkUserData)
Create a new virtual memory mapping derived from an other virtual memory mapping. ...
Definition: cpl_virtualmem.cpp:2251
int CPLIsVirtualMemFileMapAvailable(void)
Return if virtual memory mapping of a file is available.
Definition: cpl_virtualmem.cpp:2151
size_t CPLVirtualMemGetSize(CPLVirtualMem *ctxt)
Return the size of the virtual memory mapping.
Definition: cpl_virtualmem.cpp:2233
size_t CPLGetPageSize(void)
Return the size of a page of virtual memory.
Definition: cpl_virtualmem.cpp:2138
CPLVirtualMemAccessMode
Access mode of a virtual memory mapping.
Definition: cpl_virtualmem.h:102
void CPLVirtualMemFree(CPLVirtualMem *ctxt)
Free a virtual memory mapping.
Definition: cpl_virtualmem.cpp:2164
int CPLVirtualMemIsAccessThreadSafe(CPLVirtualMem *ctxt)
Return TRUE if this memory mapping can be accessed safely from concurrent threads.
Definition: cpl_virtualmem.cpp:2242
CPLVirtualMemAccessMode CPLVirtualMemGetAccessMode(CPLVirtualMem *ctxt)
Return the access mode of the virtual memory mapping.
Definition: cpl_virtualmem.cpp:2215
GUIntBig vsi_l_offset
Type for a file offset.
Definition: cpl_vsi.h:140
void CPLVirtualMemPin(CPLVirtualMem *ctxt, void *pAddr, size_t nSize, int bWriteOp)
Make sure that a region of virtual memory will be realized.
Definition: cpl_virtualmem.cpp:1981
void * CPLVirtualMemGetAddr(CPLVirtualMem *ctxt)
Return the pointer to the start of a virtual memory mapping.
Definition: cpl_virtualmem.cpp:2197
Definition: cpl_virtualmem.h:112
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:339
Definition: cpl_virtualmem.h:109
CPLVirtualMem * CPLVirtualMemNew(size_t nSize, size_t nCacheSize, size_t nPageSizeHint, int bSingleThreadUsage, CPLVirtualMemAccessMode eAccessMode, CPLVirtualMemCachePageCbk pfnCachePage, CPLVirtualMemUnCachePageCbk pfnUnCachePage, CPLVirtualMemFreeUserData pfnFreeUserData, void *pCbkUserData)
Create a new virtual memory mapping.
Definition: cpl_virtualmem.cpp:1960
CPLVirtualMem * CPLVirtualMemFileMapNew(VSILFILE *fp, vsi_l_offset nOffset, vsi_l_offset nLength, CPLVirtualMemAccessMode eAccessMode, CPLVirtualMemFreeUserData pfnFreeUserData, void *pCbkUserData)
Create a new virtual memory mapping from a file.
Definition: cpl_virtualmem.cpp:2010
void CPLVirtualMemDeclareThread(CPLVirtualMem *ctxt)
Declare that a thread will access a virtual memory mapping.
Definition: cpl_virtualmem.cpp:1977