e57::CompressedVectorReader Class Reference

#include <E57Format.h>

Public Member Functions

void checkInvariant (bool doRecurse=true)
 Check whether CompressedVectorReader class invariant is true. More...
 
void close ()
 End the read operation. More...
 
CompressedVectorNode compressedVectorNode () const
 Return the CompressedVectorNode being read. More...
 
 CompressedVectorReader ()=delete
 
void dump (int indent=0, std::ostream &os=std::cout) const
 Diagnostic function to print internal state of object to output stream in an indented format. More...
 
bool isOpen ()
 Test whether CompressedVectorReader is still open for reading. More...
 
unsigned read ()
 Request transfer of blocks of data from CompressedVectorNode into previously designated destination buffers. More...
 
unsigned read (std::vector< SourceDestBuffer > &dbufs)
 Request transfer of block of data from CompressedVectorNode into given destination buffers. More...
 
void seek (int64_t recordNumber)
 Set record number of CompressedVectorNode where next read will start. More...
 

Constructor & Destructor Documentation

◆ CompressedVectorReader()

e57::CompressedVectorReader::CompressedVectorReader ( )
delete

Member Function Documentation

◆ checkInvariant()

void CompressedVectorReader::checkInvariant ( bool  doRecurse = true)

Check whether CompressedVectorReader class invariant is true.

Parameters
[in]doRecurseIf true, also check invariants of all children or sub-objects recursively.

This function checks at least the assertions in the documented class invariant description (see class reference page for this object). Other internal invariants that are implementation-dependent may also be checked. If any invariant clause is violated, an E57Exception with errorCode of E57_ERROR_INVARIANCE_VIOLATION is thrown.

Postcondition
No visible state is modified.

References compressedVectorNode(), e57::CompressedVectorNode::destImageFile(), e57::E57_ERROR_INVARIANCE_VIOLATION, e57::CompressedVectorNode::isAttached(), isOpen(), e57::ImageFile::isOpen(), e57::ImageFile::readerCount(), and e57::ImageFile::writerCount().

◆ close()

void CompressedVectorReader::close ( )

End the read operation.

It is recommended that this function be called to gracefully end a transfer to a CompressedVectorNode. It is not an error to call this function if the CompressedVectorReader is already closed. This function will cause the CompressedVectorReader to enter the closed state, and any further transfers requests will fail.

Exceptions
E57_ERROR_INTERNALAll objects in undocumented state
See also
CompressedVectorReader::isOpen, CompressedVectorNode::reader

Referenced by e57::ReaderImpl::ReadData3DGroupsData(), and femexamples.examplesgui.FemExamples::reject().

◆ compressedVectorNode()

CompressedVectorNode CompressedVectorReader::compressedVectorNode ( ) const

Return the CompressedVectorNode being read.

It is not an error if this CompressedVectorReader is closed.

Precondition
The associated ImageFile must be open.
Returns
A smart CompressedVectorNode handle referencing the underlying object being read from.
Exceptions
E57_ERROR_IMAGEFILE_NOT_OPEN
E57_ERROR_INTERNALAll objects in undocumented state
See also
CompressedVectorReader::close, CompressedVectorNode::reader

Referenced by checkInvariant().

◆ dump()

void CompressedVectorReader::dump ( int  indent = 0,
std::ostream &  os = std::cout 
) const

Diagnostic function to print internal state of object to output stream in an indented format.

Parameters
[in]indentNumber of spaces to indent all the printed lines of this object.
[in]osOutput stream to print on.

All objects in the E57 Foundation API (with exception of E57Exception) support a dump() function. These functions print out to the console a detailed listing of the internal state of objects. The content of these printouts is not documented, and is really of interest only to implementation developers/maintainers or the really adventurous users. In implementations of the API other than the Reference Implementation, the dump() functions may produce no output (although the functions should still be defined). The output format may change from version to version.

Postcondition
No visible object state is modified.
Exceptions
NoE57Exceptions

◆ isOpen()

bool CompressedVectorReader::isOpen ( )

Test whether CompressedVectorReader is still open for reading.

Precondition
The associated ImageFile must be open.
Exceptions
E57_ERROR_IMAGEFILE_NOT_OPEN
E57_ERROR_INTERNALAll objects in undocumented state
See also
CompressedVectorReader::close, CompressedVectorNode::reader

Referenced by checkInvariant().

◆ read() [1/2]

unsigned CompressedVectorReader::read ( )

Request transfer of blocks of data from CompressedVectorNode into previously designated destination buffers.

The SourceDestBuffers used are previously designated either in CompressedVectorNode::reader where this object was created, or in the last call to CompressedVectorReader::read(std::vector<SourceDestBuffer>&) where new buffers were designated. The function will always return the full number of records requested (the capacity of the SourceDestBuffers) unless it has reached the end of the CompressedVectorNode, in which case it will return less than the capacity of the SourceDestBuffers. Partial reads will store the records at the beginning of the SourceDestBuffers. It is not an error to call this function after all records in the CompressedVectorNode have been read (the function returns 0).

If a conversion or bounds error occurs during the transfer, the CompressedVectorReader is left in an undocumented state (it can't be used any further). If a file I/O or checksum error occurs during the transfer, both the CompressedVectorReader and the associated ImageFile are left in an undocumented state (they can't be used any further).

The API user is responsible for ensuring that the underlying memory buffers represented in the SourceDestBuffers still exist when this function is called. The E57 Foundation Implementation cannot detect that a memory buffer been destroyed.

Precondition
The associated ImageFile must be open.
This CompressedVectorReader must be open (i.e isOpen())
Returns
The number of records read.
Exceptions
E57_ERROR_IMAGEFILE_NOT_OPEN
E57_ERROR_READER_NOT_OPEN
E57_ERROR_CONVERSION_REQUIREDThis CompressedVectorReader in undocumented state
E57_ERROR_VALUE_NOT_REPRESENTABLEThis CompressedVectorReader in undocumented state
E57_ERROR_SCALED_VALUE_NOT_REPRESENTABLEThis CompressedVectorReader in undocumented state
E57_ERROR_REAL64_TOO_LARGEThis CompressedVectorReader in undocumented state
E57_ERROR_EXPECTING_NUMERICThis CompressedVectorReader in undocumented state
E57_ERROR_EXPECTING_USTRINGThis CompressedVectorReader in undocumented state
E57_ERROR_BAD_CV_PACKETThis CompressedVectorReader, associated ImageFile in undocumented state
E57_ERROR_LSEEK_FAILEDThis CompressedVectorReader, associated ImageFile in undocumented state
E57_ERROR_READ_FAILEDThis CompressedVectorReader, associated ImageFile in undocumented state
E57_ERROR_BAD_CHECKSUMThis CompressedVectorReader, associated ImageFile in undocumented state
E57_ERROR_INTERNALAll objects in undocumented state
See also
CompressedVectorReader::read(std::vector<SourceDestBuffer>&), CompressedVectorNode::reader, SourceDestBuffer, CompressedVectorReader::read(std::vector<SourceDestBuffer>&)

Referenced by Points::E57Reader::read(), e57::ReaderImpl::ReadData3DGroupsData(), gzip_utf8.GzipFile::readline(), and gzip_utf8.GzipFile::seek().

◆ read() [2/2]

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

Request transfer of block of data from CompressedVectorNode into given destination buffers.

Parameters
[in]dbufsVector of memory buffers that will receive data read from a CompressedVectorNode.

The dbufs must all have the same capacity. The specified dbufs must have same number of elements as previously designated SourceDestBuffer vector. The each SourceDestBuffer within dbufs must be identical to the previously designated SourceDestBuffer except for capacity and buffer address.

The dbufs locations are saved so that a later call to CompressedVectorReader::read() can be used without having to re-specify the SourceDestBuffers.

The function will always return the full number of records requested (the capacity of the SourceDestBuffers) unless it has reached the end of the CompressedVectorNode, in which case it will return less than the capacity of the SourceDestBuffers. Partial reads will store the records at the beginning of the SourceDestBuffers. It is not an error to call this function after all records in the CompressedVectorNode have been read (the function returns 0).

If a conversion or bounds error occurs during the transfer, the CompressedVectorReader is left in an undocumented state (it can't be used any further). If a file I/O or checksum error occurs during the transfer, both the CompressedVectorReader and the associated ImageFile are left in an undocumented state (they can't be used any further).

The API user is responsible for ensuring that the underlying memory buffers represented in the SourceDestBuffers still exist when this function is called. The E57 Foundation Implementation cannot detect that a memory buffer been destroyed.

Precondition
The associated ImageFile must be open.
This CompressedVectorReader must be open (i.e isOpen())
Returns
The number of records read.
Exceptions
E57_ERROR_IMAGEFILE_NOT_OPEN
E57_ERROR_READER_NOT_OPEN
E57_ERROR_PATH_UNDEFINED
E57_ERROR_BUFFER_SIZE_MISMATCH
E57_ERROR_BUFFER_DUPLICATE_PATHNAME
E57_ERROR_CONVERSION_REQUIREDThis CompressedVectorReader in undocumented state
E57_ERROR_VALUE_NOT_REPRESENTABLEThis CompressedVectorReader in undocumented state
E57_ERROR_SCALED_VALUE_NOT_REPRESENTABLEThis CompressedVectorReader in undocumented state
E57_ERROR_REAL64_TOO_LARGEThis CompressedVectorReader in undocumented state
E57_ERROR_EXPECTING_NUMERICThis CompressedVectorReader in undocumented state
E57_ERROR_EXPECTING_USTRINGThis CompressedVectorReader in undocumented state
E57_ERROR_BAD_CV_PACKETThis CompressedVectorReader, associated ImageFile in undocumented state
E57_ERROR_LSEEK_FAILEDThis CompressedVectorReader, associated ImageFile in undocumented state
E57_ERROR_READ_FAILEDThis CompressedVectorReader, associated ImageFile in undocumented state
E57_ERROR_BAD_CHECKSUMThis CompressedVectorReader, associated ImageFile in undocumented state
E57_ERROR_INTERNALAll objects in undocumented state
See also
CompressedVectorReader::read(), CompressedVectorNode::reader, SourceDestBuffer

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

◆ seek()

void CompressedVectorReader::seek ( int64_t  recordNumber)

Set record number of CompressedVectorNode where next read will start.

Parameters
[in]recordNumberThe index of record in ComressedVectorNode where next read using this CompressedVectorReader will start.

This function may be called at any time (as long as ImageFile and CompressedVectorReader are open). The next read will start at the given recordNumber. It is not an error to seek to recordNumber = childCount() (i.e. to one record past end of CompressedVectorNode).

Precondition
recordNumber <= childCount() of CompressedVectorNode.
The associated ImageFile must be open.
This CompressedVectorReader must be open (i.e isOpen())
Exceptions
E57_ERROR_BAD_API_ARGUMENT
E57_ERROR_IMAGEFILE_NOT_OPEN
E57_ERROR_READER_NOT_OPEN
E57_ERROR_BAD_CV_PACKET
E57_ERROR_LSEEK_FAILED
E57_ERROR_READ_FAILED
E57_ERROR_BAD_CHECKSUM
E57_ERROR_INTERNALAll objects in undocumented state
See also
CompressedVectorNode::reader

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