本文整理汇总了C++中BaseType::buf2val方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseType::buf2val方法的具体用法?C++ BaseType::buf2val怎么用?C++ BaseType::buf2val使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseType
的用法示例。
在下文中一共展示了BaseType::buf2val方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
OGRFeature *OGRDODSSequenceLayer::GetFeature( GIntBig nFeatureId )
{
/* -------------------------------------------------------------------- */
/* Ensure we have the dataset. */
/* -------------------------------------------------------------------- */
if( !ProvideDataDDS() )
return NULL;
Sequence *seq = dynamic_cast<Sequence *>(poTargetVar);
/* -------------------------------------------------------------------- */
/* Figure out what the super and subsequence number this */
/* feature will be, and validate it. If there is not super */
/* sequence the feature id is the subsequence number. */
/* -------------------------------------------------------------------- */
int iSubSeq = -1;
if( nFeatureId < 0 || nFeatureId >= nRecordCount )
return NULL;
if( poSuperSeq == NULL )
iSubSeq = nFeatureId;
else
{
int nSeqOffset = 0, iSuperSeq;
// for now we just scan through till find find out what
// super sequence this in. In the long term we need a better (cached)
// approach that doesn't involve this quadratic cost.
for( iSuperSeq = 0;
iSuperSeq < nSuperSeqCount;
iSuperSeq++ )
{
if( nSeqOffset + panSubSeqSize[iSuperSeq] > nFeatureId )
{
iSubSeq = nFeatureId - nSeqOffset;
break;
}
nSeqOffset += panSubSeqSize[iSuperSeq];
}
CPLAssert( iSubSeq != -1 );
// Make sure we have the right target var ... the one
// corresponding to our current super sequence.
if( iSuperSeq != iLastSuperSeq )
{
iLastSuperSeq = iSuperSeq;
poTargetVar = poSuperSeq->var_value( iSuperSeq, pszSubSeqPath );
seq = dynamic_cast<Sequence *>(poTargetVar);
}
}
/* -------------------------------------------------------------------- */
/* Create the feature being read. */
/* -------------------------------------------------------------------- */
OGRFeature *poFeature;
poFeature = new OGRFeature( poFeatureDefn );
poFeature->SetFID( nFeatureId );
m_nFeaturesRead++;
/* -------------------------------------------------------------------- */
/* Process all the regular data fields. */
/* -------------------------------------------------------------------- */
int iField;
for( iField = 0; iField < poFeatureDefn->GetFieldCount(); iField++ )
{
if( papoFields[iField]->pszPathToSequence )
continue;
BaseType *poFieldVar = GetFieldValue( papoFields[iField], iSubSeq,
NULL );
if( poFieldVar == NULL )
continue;
switch( poFieldVar->type() )
{
case dods_byte_c:
{
signed char byVal;
void *pValPtr = &byVal;
poFieldVar->buf2val( &pValPtr );
poFeature->SetField( iField, byVal );
}
break;
case dods_int16_c:
{
GInt16 nIntVal;
void *pValPtr = &nIntVal;
poFieldVar->buf2val( &pValPtr );
poFeature->SetField( iField, nIntVal );
}
break;
//.........这里部分代码省略.........