ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
e57::CompressedVectorReaderImpl Class Reference

#include <CompressedVectorReaderImpl.h>

Public Member Functions

 CompressedVectorReaderImpl (std::shared_ptr< CompressedVectorNodeImpl > ni, std::vector< SourceDestBuffer > &dbufs)
 
 ~CompressedVectorReaderImpl ()
 
unsigned read ()
 
unsigned read (std::vector< SourceDestBuffer > &dbufs)
 
void seek (uint64_t recordNumber)
 
bool isOpen () const
 
std::shared_ptr< CompressedVectorNodeImplcompressedVectorNode () const
 
void close ()
 
void dump (int indent=0, std::ostream &os=std::cout)
 

Detailed Description

Definition at line 36 of file CompressedVectorReaderImpl.h.

Constructor & Destructor Documentation

◆ CompressedVectorReaderImpl()

e57::CompressedVectorReaderImpl::CompressedVectorReaderImpl ( std::shared_ptr< CompressedVectorNodeImpl ni,
std::vector< SourceDestBuffer > &  dbufs 
)

Allow reading of a completed CompressedVector, whether file is being read or currently being written. ??? what other situations need checking for? ??? check if CV not yet written to? ??? file in error state?

Empty dbufs is an error

Get CompressedArray's prototype node (all array elements must match this type)

Check dbufs well formed (matches proto exactly)

For each dbuf, create an appropriate Decoder based on the cVector_ attributes

Calc which stream the given path belongs to. This depends on position of the node in the proto tree.

Get how many records are actually defined

Read CompressedVector section header

Pre-calc end of section, so can tell when we are out of packets.

Convert physical offset to first data packet to logical

Verify that packet given by dataPhysicalOffset is actually a data packet, init channels

Double check that have a data packet

Have good packet, initialize channels

Just before return (and can't throw) increment reader count ??? safer way to assure don't miss close?

If get here, the reader is open

Definition at line 38 of file CompressedVectorReaderImpl.cpp.

References e57::DATA_PACKET, e57::CompressedVectorSectionHeader::dataPhysicalOffset, e57::Decoder::DecoderFactory(), e57::E57_ERROR_BAD_API_ARGUMENT, e57::E57_ERROR_BAD_CV_PACKET, e57::E57_ERROR_INTERNAL, E57_EXCEPTION2, QtCompat::endl(), e57::PacketReadCache::lock(), e57::CheckedFile::Logical, e57::CheckedFile::Physical, e57::CompressedVectorSectionHeader::sectionLogicalLength, e57::toString(), and e57::CompressedVectorSectionHeader::verify().

◆ ~CompressedVectorReaderImpl()

e57::CompressedVectorReaderImpl::~CompressedVectorReaderImpl ( )

??? what if already closed?

Definition at line 155 of file CompressedVectorReaderImpl.cpp.

References close(), and QtCompat::endl().

Member Function Documentation

◆ close()

void e57::CompressedVectorReaderImpl::close ( )

Before anything that can throw, decrement reader count

No error if reader not open

Destroy decoders

Definition at line 537 of file CompressedVectorReaderImpl.cpp.

Referenced by ~CompressedVectorReaderImpl().

◆ compressedVectorNode()

std::shared_ptr< CompressedVectorNodeImpl > e57::CompressedVectorReaderImpl::compressedVectorNode ( ) const

Definition at line 532 of file CompressedVectorReaderImpl.cpp.

◆ dump()

void e57::CompressedVectorReaderImpl::dump ( int  indent = 0,
std::ostream &  os = std::cout 
)

Definition at line 577 of file CompressedVectorReaderImpl.cpp.

References QtCompat::endl(), and e57::space().

◆ isOpen()

bool e57::CompressedVectorReaderImpl::isOpen ( ) const

don't checkImageFileOpen(FILE, LINE, FUNCTION), or checkReaderOpen()

Definition at line 525 of file CompressedVectorReaderImpl.cpp.

◆ read() [1/2]

unsigned e57::CompressedVectorReaderImpl::read ( )

Rewind all dbufs so start writing to them at beginning

Allow decoders to use data they already have in their queue to fill newly empty dbufs This helps to keep decoder input queues smaller, which reduces backtracking in the packet cache.

Loop until every dbuf is full or we have reached end of the binary section.

Find the earliest packet position for channels that are still hungry It's important to call inputProcess of the decoders before this call, so current hungriness level is reflected.

If nobody's hungry, we are done with the read

Feed packet to the hungry decoders

Verify that each channel produced the same number of records

Return number of records transferred to each dbuf.

Definition at line 218 of file CompressedVectorReaderImpl.cpp.

References e57::DecodeChannel::dbuf, e57::E57_ERROR_INTERNAL, E57_EXCEPTION2, QtCompat::endl(), and e57::toString().

Referenced by read().

◆ read() [2/2]

unsigned e57::CompressedVectorReaderImpl::read ( std::vector< SourceDestBuffer > &  dbufs)

don't checkImageFileOpen(FILE, LINE, FUNCTION), read() will do it

Check compatible with current dbufs

Definition at line 205 of file CompressedVectorReaderImpl.cpp.

References read().

◆ seek()

void e57::CompressedVectorReaderImpl::seek ( uint64_t  recordNumber)

!!! implement

Definition at line 517 of file CompressedVectorReaderImpl.cpp.

References e57::E57_ERROR_NOT_IMPLEMENTED, and E57_EXCEPTION1.


The documentation for this class was generated from the following files: