MCPcopy Create free account
hub / github.com/PDAL/PDAL / getNextInt64

Method getNextInt64

plugins/e57/libE57Format/src/SourceDestBufferImpl.cpp:317–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315}
316
317int64_t SourceDestBufferImpl::getNextInt64()
318{
319 /// don't checkImageFileOpen
320
321 /// Verify index is within bounds
322 if ( nextIndex_ >= capacity_ )
323 {
324 throw E57_EXCEPTION2( ErrorInternal, "pathName=" + pathName_ );
325 }
326
327 /// Fetch value from source buffer.
328 /// Convert from non-integer formats if requested.
329 char *p = &base_[nextIndex_ * stride_];
330 int64_t value;
331 switch ( memoryRepresentation_ )
332 {
333 case Int8:
334 value = static_cast<int64_t>( *reinterpret_cast<int8_t *>( p ) );
335 break;
336 case UInt8:
337 value = static_cast<int64_t>( *reinterpret_cast<uint8_t *>( p ) );
338 break;
339 case Int16:
340 value = static_cast<int64_t>( *reinterpret_cast<int16_t *>( p ) );
341 break;
342 case UInt16:
343 value = static_cast<int64_t>( *reinterpret_cast<uint16_t *>( p ) );
344 break;
345 case Int32:
346 value = static_cast<int64_t>( *reinterpret_cast<int32_t *>( p ) );
347 break;
348 case UInt32:
349 value = static_cast<int64_t>( *reinterpret_cast<uint32_t *>( p ) );
350 break;
351 case Int64:
352 value = *reinterpret_cast<int64_t *>( p );
353 break;
354 case Bool:
355 if ( !doConversion_ )
356 {
357 throw E57_EXCEPTION2( ErrorConversionRequired, "pathName=" + pathName_ );
358 }
359 /// Convert bool to 0/1, all non-zero values map to 1.0
360 value = ( *reinterpret_cast<bool *>( p ) ) ? 1 : 0;
361 break;
362 case Real32:
363 if ( !doConversion_ )
364 {
365 throw E57_EXCEPTION2( ErrorConversionRequired, "pathName=" + pathName_ );
366 }
367 //??? fault if get special value: NaN, NegInf...
368 value = static_cast<int64_t>( *reinterpret_cast<float *>( p ) );
369 break;
370 case Real64:
371 if ( !doConversion_ )
372 {
373 throw E57_EXCEPTION2( ErrorConversionRequired, "pathName=" + pathName_ );
374 }

Callers 1

processRecordsMethod · 0.80

Calls 1

toStringFunction · 0.70

Tested by

no test coverage detected