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

Method getNextFloat

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

Source from the content-addressed store, hash-verified

505}
506
507float SourceDestBufferImpl::getNextFloat()
508{
509 /// don't checkImageFileOpen
510
511 /// Verify index is within bounds
512 if ( nextIndex_ >= capacity_ )
513 {
514 throw E57_EXCEPTION2( ErrorInternal, "pathName=" + pathName_ );
515 }
516
517 /// Fetch value from source buffer.
518 /// Convert from other formats to floating point if requested
519 char *p = &base_[nextIndex_ * stride_];
520 float value;
521 switch ( memoryRepresentation_ )
522 {
523 case Int8:
524 if ( !doConversion_ )
525 {
526 throw E57_EXCEPTION2( ErrorConversionRequired, "pathName=" + pathName_ );
527 }
528 value = static_cast<float>( *reinterpret_cast<int8_t *>( p ) );
529 break;
530 case UInt8:
531 if ( !doConversion_ )
532 {
533 throw E57_EXCEPTION2( ErrorConversionRequired, "pathName=" + pathName_ );
534 }
535 value = static_cast<float>( *reinterpret_cast<uint8_t *>( p ) );
536 break;
537 case Int16:
538 if ( !doConversion_ )
539 {
540 throw E57_EXCEPTION2( ErrorConversionRequired, "pathName=" + pathName_ );
541 }
542 value = static_cast<float>( *reinterpret_cast<int16_t *>( p ) );
543 break;
544 case UInt16:
545 if ( !doConversion_ )
546 {
547 throw E57_EXCEPTION2( ErrorConversionRequired, "pathName=" + pathName_ );
548 }
549 value = static_cast<float>( *reinterpret_cast<uint16_t *>( p ) );
550 break;
551 case Int32:
552 if ( !doConversion_ )
553 {
554 throw E57_EXCEPTION2( ErrorConversionRequired, "pathName=" + pathName_ );
555 }
556 value = static_cast<float>( *reinterpret_cast<int32_t *>( p ) );
557 break;
558 case UInt32:
559 if ( !doConversion_ )
560 {
561 throw E57_EXCEPTION2( ErrorConversionRequired, "pathName=" + pathName_ );
562 }
563 value = static_cast<float>( *reinterpret_cast<uint32_t *>( p ) );
564 break;

Callers 1

processRecordsMethod · 0.80

Calls 1

toStringFunction · 0.70

Tested by

no test coverage detected