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

Method packetWriteIndex

plugins/e57/libE57Format/src/CompressedVectorWriterImpl.cpp:669–689  ·  view source on GitHub ↗

Write one index packet. We don't have an interface to work with index packets, but one is required by the standard, so write one index packet with one entry pointing to the first data packet.

Source from the content-addressed store, hash-verified

667 // We don't have an interface to work with index packets, but one is required by the standard, so
668 // write one index packet with one entry pointing to the first data packet.
669 void e57::CompressedVectorWriterImpl::packetWriteIndex()
670 {
671 ImageFileImplSharedPtr imf( cVector_->destImageFile_ );
672
673 IndexPacket indexPacket;
674
675 indexPacket.entries[0].chunkPhysicalOffset = dataPhysicalOffset_;
676
677 const auto cPacketLength = sizeof( IndexPacketHeader ) + sizeof( IndexPacket::Entry );
678
679 indexPacket.header.packetLogicalLengthMinus1 = cPacketLength - 1;
680 indexPacket.header.entryCount = 1;
681
682 uint64_t packetLogicalOffset = imf->allocateSpace( cPacketLength, false );
683 topIndexPhysicalOffset_ = imf->file_->logicalToPhysical( packetLogicalOffset );
684
685 imf->file_->seek( packetLogicalOffset );
686 imf->file_->write( reinterpret_cast<const char *>( &indexPacket ), cPacketLength );
687
688 indexPacketsCount_++;
689 }
690
691 void CompressedVectorWriterImpl::flush()
692 {

Callers

nothing calls this directly

Calls 4

allocateSpaceMethod · 0.80
logicalToPhysicalMethod · 0.80
seekMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected