SEXP RGDAL_CloseDataset(SEXP sxpDataset) { SEXP sxpHandle = getObjHandle(sxpDataset); if (sxpHandle == NULL) return(R_NilValue); RGDAL_CloseHandle(sxpHandle); return(R_NilValue); }
SEXP RGDAL_DeleteHandle(SEXP sxpHandle) { GDALDataset *pDataset = (GDALDataset *) R_ExternalPtrAddr(sxpHandle); if (pDataset == NULL) return(R_NilValue); GDALDriver *pDriver = pDataset->GetDriver(); const char *filename = pDataset->GetDescription(); deleteFile(pDriver, filename); RGDAL_CloseHandle(sxpHandle); return(R_NilValue); }
SEXP RGDAL_CloseDataset(SEXP sxpDataset) { SEXP sxpHandle = getObjHandle(sxpDataset); if (sxpHandle == NULL) return(R_NilValue); const char *classname = asString(getAttrib(sxpDataset, R_ClassSymbol)); if (strcmp(classname, "GDALTransientDataset") == 0) { RGDAL_DeleteHandle(sxpHandle); } else { RGDAL_CloseHandle(sxpHandle); } return(R_NilValue); }