e57::CompressedVectorReaderImpl Class Reference

#include <CompressedVectorReaderImpl.h>

Public Member Functions

void close ()
 
std::shared_ptr< CompressedVectorNodeImplcompressedVectorNode () const
 
 CompressedVectorReaderImpl (std::shared_ptr< CompressedVectorNodeImpl > ni, std::vector< SourceDestBuffer > &dbufs)
 
bool isOpen () const
 
unsigned read ()
 
unsigned read (std::vector< SourceDestBuffer > &dbufs)
 
void seek (uint64_t recordNumber)
 
 ~CompressedVectorReaderImpl ()
 

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

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::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?

References close().

Member Function Documentation

◆ close()

void e57::CompressedVectorReaderImpl::close ( )

Before anything that can throw, decrement reader count

No error if reader not open

Destroy decoders

Referenced by femexamples.examplesgui.FemExamples::reject(), and ~CompressedVectorReaderImpl().

◆ compressedVectorNode()

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

◆ isOpen()

bool e57::CompressedVectorReaderImpl::isOpen ( ) const

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

◆ 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.

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

Referenced by read(), gzip_utf8.GzipFile::readline(), and gzip_utf8.GzipFile::seek().

◆ 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

References read().

Referenced by gzip_utf8.GzipFile::readline(), and gzip_utf8.GzipFile::seek().

◆ seek()

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

!!! implement

References e57::E57_ERROR_NOT_IMPLEMENTED.


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