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

Method findNextDataPacket

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

Source from the content-addressed store, hash-verified

505 }
506
507 uint64_t CompressedVectorReaderImpl::findNextDataPacket( uint64_t nextPacketLogicalOffset )
508 {
509#ifdef E57_VERBOSE
510 std::cout << " searching for next data packet, nextPacketLogicalOffset="
511 << nextPacketLogicalOffset
512 << " sectionEndLogicalOffset=" << sectionEndLogicalOffset_ << std::endl;
513#endif
514
515 // Starting at nextPacketLogicalOffset, search for next data packet until
516 // hit end of binary section.
517 while ( nextPacketLogicalOffset < sectionEndLogicalOffset_ )
518 {
519 char *anyPacket = nullptr;
520
521 std::unique_ptr<PacketLock> packetLock =
522 cache_->lock( nextPacketLogicalOffset, anyPacket );
523
524 // Guess it's a data packet, if not continue to next packet
525 auto dpkt = reinterpret_cast<const DataPacket *>( anyPacket );
526
527 if ( dpkt->header.packetType == DATA_PACKET )
528 {
529#ifdef E57_VERBOSE
530 std::cout << " Found next data packet at nextPacketLogicalOffset="
531 << nextPacketLogicalOffset << std::endl;
532#endif
533 return nextPacketLogicalOffset;
534 }
535
536 // All packets have length in same place, so can use the field to skip to
537 // next packet.
538 nextPacketLogicalOffset += dpkt->header.packetLogicalLengthMinus1 + 1;
539 }
540
541 // Ran off end of section, so return failure code.
542 return UINT64_MAX;
543 }
544
545 void CompressedVectorReaderImpl::seek( uint64_t /*recordNumber*/ )
546 {

Callers

nothing calls this directly

Calls 1

lockMethod · 0.80

Tested by

no test coverage detected