本文整理汇总了C++中CPL_IGNORE_RET_VAL函数的典型用法代码示例。如果您正苦于以下问题:C++ CPL_IGNORE_RET_VAL函数的具体用法?C++ CPL_IGNORE_RET_VAL怎么用?C++ CPL_IGNORE_RET_VAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CPL_IGNORE_RET_VAL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: definitions
/*!
\brief Load data block definitions (&B)
Call VFKReader::OpenFile() before this function.
\return number of data blocks or -1 on error
*/
int VFKReaderSQLite::ReadDataBlocks()
{
int nDataBlocks = -1;
CPLString osSQL;
const char *pszName, *pszDefn;
IVFKDataBlock *poNewDataBlock;
sqlite3_stmt *hStmt;
osSQL.Printf("SELECT table_name, table_defn FROM %s", VFK_DB_TABLE);
hStmt = PrepareStatement(osSQL.c_str());
while(ExecuteSQL(hStmt) == OGRERR_NONE) {
pszName = (const char*) sqlite3_column_text(hStmt, 0);
pszDefn = (const char*) sqlite3_column_text(hStmt, 1);
poNewDataBlock = (IVFKDataBlock *) CreateDataBlock(pszName);
poNewDataBlock->SetGeometryType();
poNewDataBlock->SetProperties(pszDefn);
VFKReader::AddDataBlock(poNewDataBlock, NULL);
}
if (m_nDataBlockCount == 0) {
CPL_IGNORE_RET_VAL(sqlite3_exec(m_poDB, "BEGIN", NULL, NULL, NULL));
/* CREATE TABLE ... */
nDataBlocks = VFKReader::ReadDataBlocks();
CPL_IGNORE_RET_VAL(sqlite3_exec(m_poDB, "COMMIT", NULL, NULL, NULL));
StoreInfo2DB();
}
return nDataBlocks;
}
示例2: main
int main(int argc, char* argv[])
{
CPLJoinableThread* hThread;
printf("main thread %p\n", (void*)CPLGetPID());
argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 );
CPLSetConfigOption("GDAL_CACHEMAX", "0");
CPLSetConfigOption("GDAL_DEBUG_BLOCK_CACHE", "ON");
MyDataset* poDS = new MyDataset();
char buf1[] = { 1 } ;
CPL_IGNORE_RET_VAL(GDALRasterIO(GDALGetRasterBand(poDS, 1), GF_Write, 0, 0, 1, 1, buf1, 1, 1, GDT_Byte, 0, 0));
hThread = CPLCreateJoinableThread(thread_func, NULL);
CPLSleep(0.3);
CPL_IGNORE_RET_VAL(GDALRasterIO(GDALGetRasterBand(poDS, 1), GF_Write, 1, 0, 1, 1, buf1, 1, 1, GDT_Byte, 0, 0));
GDALFlushCacheBlock();
CPLJoinThread(hThread);
delete poDS;
GDALDestroyDriverManager();
CSLDestroy( argv );
return 0;
}
示例3: CPLError
CPLErr CTable2Dataset::SetGeoTransform( double * padfTransform )
{
if( eAccess == GA_ReadOnly )
{
CPLError( CE_Failure, CPLE_NoWriteAccess,
"Unable to update geotransform on readonly file." );
return CE_Failure;
}
if( padfTransform[2] != 0.0 || padfTransform[4] != 0.0 )
{
CPLError(
CE_Failure, CPLE_AppDefined,
"Rotated and sheared geotransforms not supported for CTable2." );
return CE_Failure;
}
memcpy( adfGeoTransform, padfTransform, sizeof(double)*6 );
/* -------------------------------------------------------------------- */
/* Update grid header. */
/* -------------------------------------------------------------------- */
const double dfDegToRad = M_PI / 180.0;
// read grid header
CPL_IGNORE_RET_VAL(VSIFSeekL( fpImage, 0, SEEK_SET ));
char achHeader[160] = { '\0' };
CPL_IGNORE_RET_VAL(VSIFReadL( achHeader, 1, sizeof(achHeader), fpImage ));
// lower left origin (longitude, center of pixel, radians)
double dfValue = (adfGeoTransform[0] + adfGeoTransform[1]*0.5) * dfDegToRad;
CPL_LSBPTR64( &dfValue );
memcpy( achHeader + 96, &dfValue, 8 );
// lower left origin (latitude, center of pixel, radians)
dfValue = (adfGeoTransform[3] + adfGeoTransform[5] * (nRasterYSize-0.5))
* dfDegToRad;
CPL_LSBPTR64( &dfValue );
memcpy( achHeader + 104, &dfValue, 8 );
// pixel width (radians)
dfValue = adfGeoTransform[1] * dfDegToRad;
CPL_LSBPTR64( &dfValue );
memcpy( achHeader + 112, &dfValue, 8 );
// pixel height (radians)
dfValue = adfGeoTransform[5] * -1 * dfDegToRad;
CPL_LSBPTR64( &dfValue );
memcpy( achHeader + 120, &dfValue, 8 );
// write grid header.
CPL_IGNORE_RET_VAL(VSIFSeekL( fpImage, 0, SEEK_SET ));
CPL_IGNORE_RET_VAL(VSIFWriteL( achHeader, 11, 16, fpImage ));
return CE_None;
}
示例4: OGRFormatDouble
void OGRBNALayer::WriteCoord(VSILFILE* fp, double dfX, double dfY)
{
char szBuffer[64];
OGRFormatDouble(szBuffer, sizeof(szBuffer), dfX, '.', poDS->GetCoordinatePrecision());
CPL_IGNORE_RET_VAL(VSIFPrintfL( fp, "%s", szBuffer));
CPL_IGNORE_RET_VAL(VSIFPrintfL( fp, "%s", poDS->GetCoordinateSeparator()));
OGRFormatDouble(szBuffer, sizeof(szBuffer), dfY, '.', poDS->GetCoordinatePrecision());
CPL_IGNORE_RET_VAL(VSIFPrintfL( fp, "%s", szBuffer));
}
示例5: FlushCache
FASTDataset::~FASTDataset()
{
FlushCache();
CPLFree( pszDirname );
CPLFree( pszProjection );
for ( int i = 0; i < nBands; i++ )
if ( fpChannels[i] )
CPL_IGNORE_RET_VAL(VSIFCloseL( fpChannels[i] ));
if( fpHeader != NULL )
CPL_IGNORE_RET_VAL(VSIFCloseL( fpHeader ));
}
示例6: CPL_IGNORE_RET_VAL
void BTDataset::FlushCache()
{
GDALDataset::FlushCache();
if( !bHeaderModified )
return;
bHeaderModified = FALSE;
CPL_IGNORE_RET_VAL(VSIFSeekL( fpImage, 0, SEEK_SET ));
CPL_IGNORE_RET_VAL(VSIFWriteL( abyHeader, 256, 1, fpImage ));
}
示例7: FlushCache
JDEMDataset::~JDEMDataset()
{
FlushCache();
if( fp != NULL )
CPL_IGNORE_RET_VAL(VSIFCloseL( fp ));
}
示例8: FlushCache
GSCDataset::~GSCDataset()
{
FlushCache();
if( fpImage != NULL )
CPL_IGNORE_RET_VAL(VSIFCloseL( fpImage ));
}
示例9: ReadInt
static int ReadInt( VSILFILE *fp )
{
char c;
int nRead = 0;
char szBuffer[12];
bool bInProlog = true;
while( true )
{
if (VSIFReadL(&c, 1, 1, fp) != 1)
{
return 0;
}
if( bInProlog )
{
if ( !isspace( static_cast<int>(c) ) )
{
bInProlog = false;
}
}
if( !bInProlog )
{
if( c != '-' && c != '+' && !(c >= '0' && c <= '9') )
{
CPL_IGNORE_RET_VAL(VSIFSeekL(fp, VSIFTellL(fp) - 1, SEEK_SET));
break;
}
if( nRead < 11 )
szBuffer[nRead] = c;
nRead ++;
}
}
szBuffer[std::min(nRead, 11)] = 0;
return atoi(szBuffer);
}
示例10: PAuxDelete
static CPLErr PAuxDelete( const char * pszBasename )
{
VSILFILE *fp = VSIFOpenL( CPLResetExtension( pszBasename, "aux" ), "r" );
if( fp == NULL )
{
CPLError( CE_Failure, CPLE_AppDefined,
"%s does not appear to be a PAux dataset, there is no .aux file.",
pszBasename );
return CE_Failure;
}
const char *pszLine = CPLReadLineL( fp );
CPL_IGNORE_RET_VAL(VSIFCloseL( fp ));
if( pszLine == NULL || !STARTS_WITH_CI(pszLine, "AuxilaryTarget") )
{
CPLError( CE_Failure, CPLE_AppDefined,
"%s does not appear to be a PAux dataset,\n"
"the .aux file does not start with AuxilaryTarget",
pszBasename );
return CE_Failure;
}
if( VSIUnlink( pszBasename ) != 0 )
{
CPLError( CE_Failure, CPLE_AppDefined,
"OS unlinking file %s.", pszBasename );
return CE_Failure;
}
VSIUnlink( CPLResetExtension( pszBasename, "aux" ) );
return CE_None;
}
示例11: CPL_IGNORE_RET_VAL
CPLErr JDEMRasterBand::IReadBlock( CPL_UNUSED int nBlockXOff,
int nBlockYOff,
void * pImage )
{
JDEMDataset *poGDS = static_cast<JDEMDataset *>(poDS);
if (pszRecord == nullptr)
{
if (bBufferAllocFailed)
return CE_Failure;
pszRecord = static_cast<char *>(VSI_MALLOC_VERBOSE(nRecordSize));
if (pszRecord == nullptr)
{
bBufferAllocFailed = true;
return CE_Failure;
}
}
CPL_IGNORE_RET_VAL(
VSIFSeekL(poGDS->fp, 1011 + nRecordSize * nBlockYOff, SEEK_SET));
CPL_IGNORE_RET_VAL(VSIFReadL(pszRecord, 1, nRecordSize, poGDS->fp));
if( !EQUALN(reinterpret_cast<char *>(poGDS->abyHeader), pszRecord, 6) )
{
CPLError(CE_Failure, CPLE_AppDefined,
"JDEM Scanline corrupt. Perhaps file was not transferred "
"in binary mode?");
return CE_Failure;
}
if( JDEMGetField(pszRecord + 6, 3) != nBlockYOff + 1 )
{
CPLError(CE_Failure, CPLE_AppDefined,
"JDEM scanline out of order, JDEM driver does not "
"currently support partial datasets.");
return CE_Failure;
}
for( int i = 0; i < nBlockXSize; i++ )
static_cast<float *>(pImage)[i] =
JDEMGetField(pszRecord + 9 + 5 * i, 5) * 0.1f;
return CE_None;
}
示例12: FlushCache
DOQ1Dataset::~DOQ1Dataset()
{
FlushCache();
CPLFree( pszProjection );
if( fpImage != NULL )
CPL_IGNORE_RET_VAL(VSIFCloseL( fpImage ));
}
示例13: FlushCache
USGSDEMDataset::~USGSDEMDataset()
{
FlushCache();
CPLFree( pszProjection );
if( fp != nullptr )
CPL_IGNORE_RET_VAL(VSIFCloseL( fp ));
}
示例14: GDALWriteIMDMultiLine
static void GDALWriteIMDMultiLine( VSILFILE *fp, const char *pszValue )
{
char **papszItems = CSLTokenizeStringComplex( pszValue, "(,) ",
FALSE, FALSE );
const int nItemCount = CSLCount(papszItems);
CPL_IGNORE_RET_VAL(VSIFPrintfL( fp, "(\n" ));
for( int i = 0; i < nItemCount; i++ )
{
if( i == nItemCount-1 )
CPL_IGNORE_RET_VAL(VSIFPrintfL( fp, "\t%s );\n", papszItems[i] ));
else
CPL_IGNORE_RET_VAL(VSIFPrintfL( fp, "\t%s,\n", papszItems[i] ));
}
CSLDestroy( papszItems );
}
示例15: CPLError
GDALDataset *JDEMDataset::Open( GDALOpenInfo *poOpenInfo )
{
// Confirm that the header is compatible with a JDEM dataset.
if (!Identify(poOpenInfo))
return nullptr;
// Confirm the requested access is supported.
if( poOpenInfo->eAccess == GA_Update )
{
CPLError(CE_Failure, CPLE_NotSupported,
"The JDEM driver does not support update access to existing "
"datasets.");
return nullptr;
}
// Check that the file pointer from GDALOpenInfo* is available.
if( poOpenInfo->fpL == nullptr )
{
return nullptr;
}
// Create a corresponding GDALDataset.
JDEMDataset *poDS = new JDEMDataset();
// Borrow the file pointer from GDALOpenInfo*.
poDS->fp = poOpenInfo->fpL;
poOpenInfo->fpL = nullptr;
// Read the header.
CPL_IGNORE_RET_VAL(VSIFReadL(poDS->abyHeader, 1, 1012, poDS->fp));
const char *psHeader = reinterpret_cast<char *>(poDS->abyHeader);
poDS->nRasterXSize = JDEMGetField(psHeader + 23, 3);
poDS->nRasterYSize = JDEMGetField(psHeader + 26, 3);
if( poDS->nRasterXSize <= 0 || poDS->nRasterYSize <= 0 )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Invalid dimensions : %d x %d",
poDS->nRasterXSize, poDS->nRasterYSize);
delete poDS;
return nullptr;
}
// Create band information objects.
poDS->SetBand(1, new JDEMRasterBand(poDS, 1));
// Initialize any PAM information.
poDS->SetDescription(poOpenInfo->pszFilename);
poDS->TryLoadXML();
// Check for overviews.
poDS->oOvManager.Initialize(poDS, poOpenInfo->pszFilename);
return poDS;
}