Skip to content
Permalink
Browse files

Merge pull request #2014 from lijun99/vrt_mmap

VRTRawRasterBand: add GetVirtualMemAuto interface to enable mmap io
  • Loading branch information
rouault committed Nov 13, 2019
2 parents 54536a3 + c035018 commit b8ece9b56c095c2a13eec9634f7586f0b7ce4842
Showing with 27 additions and 1 deletion.
  1. +6 −1 gdal/frmts/vrt/vrtdataset.h
  2. +21 −0 gdal/frmts/vrt/vrtrawrasterband.cpp
@@ -817,6 +817,11 @@ class CPL_DLL VRTRawRasterBand CPL_NON_FINAL: public VRTRasterBand

void ClearRawLink();

CPLVirtualMem *GetVirtualMemAuto( GDALRWFlag eRWFlag,
int *pnPixelSpace,
GIntBig *pnLineSpace,
char **papszOptions ) override;

virtual void GetFileList( char*** ppapszFileList, int *pnSize,
int *pnMaxSize, CPLHashSet* hSetFiles ) override;
};
@@ -1357,7 +1362,7 @@ class VRTDimension final: public GDALDimension
const CPLXMLNode* psNode);

std::shared_ptr<GDALMDArray> GetIndexingVariable() const override;

bool SetIndexingVariable(std::shared_ptr<GDALMDArray> poIndexingVariable) override;

void Serialize(CPLXMLNode* psParent) const;
@@ -322,6 +322,27 @@ void VRTRawRasterBand::ClearRawLink()
m_pszSourceFilename = nullptr;
}

/************************************************************************/
/* GetVirtualMemAuto() */
/************************************************************************/

CPLVirtualMem * VRTRawRasterBand::GetVirtualMemAuto( GDALRWFlag eRWFlag,
int *pnPixelSpace,
GIntBig *pnLineSpace,
char **papszOptions )

{
// check the pointer to RawRasterBand
if( m_poRawRaster == nullptr )
{
// use the super class method
return VRTRasterBand::GetVirtualMemAuto(eRWFlag, pnPixelSpace, pnLineSpace, papszOptions);
}
// if available, use the RawRasterBand method (use mmap if available)
return m_poRawRaster->GetVirtualMemAuto(eRWFlag, pnPixelSpace, pnLineSpace, papszOptions);
}


/************************************************************************/
/* XMLInit() */
/************************************************************************/

0 comments on commit b8ece9b

Please sign in to comment.
You can’t perform that action at this time.