libE57Format 3.1.1
C++ library to read & write the E57 file format for point cloud data
|
An iterator object keeping track of a read in progress from a CompressedVectorNode. More...
#include <E57Format.h>
Public Member Functions | |
CompressedVectorReader ()=delete | |
void | checkInvariant (bool doRecurse=true) |
Check whether CompressedVectorReader class invariant is true. | |
void | close () |
End the read operation. | |
CompressedVectorNode | compressedVectorNode () const |
Return the CompressedVectorNode being read. | |
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. | |
bool | isOpen () |
Test whether CompressedVectorReader is still open for reading. | |
unsigned | read () |
Request transfer of blocks of data from CompressedVectorNode into previously designated destination buffers. | |
unsigned | read (std::vector< SourceDestBuffer > &dbufs) |
Request transfer of block of data from CompressedVectorNode into given destination buffers. | |
void | seek (int64_t recordNumber) |
Set record number of CompressedVectorNode where next read will start. | |
An iterator object keeping track of a read in progress from a CompressedVectorNode.
A CompressedVectorReader object is a block iterator that reads blocks of records from a CompressedVectorNode and stores them in memory buffers (SourceDestBuffers). Blocks of records are processed rather than a single record-at-a-time for efficiency reasons. The CompressedVectorReader class encapsulates all the state that must be saved in between the processing of one record block and the next (e.g. partially read disk pages, or data decompression state). New memory buffers can be used for each record block read, or the previous buffers can be reused.
CompressedVectorReader objects have an open/closed state. Initially a newly created CompressedVectorReader is in the open state. After the API user calls CompressedVectorReader::close, the object will be in the closed state and no more data transfers will be possible.
There is no CompressedVectorReader constructor in the API. The function CompressedVectorNode::reader returns an already constructed CompressedVectorReader object with given memory buffers (SourceDestBuffers) already associated.
It is recommended to call CompressedVectorReader::close to gracefully end the transfer. Unlike the CompressedVectorWriter, not all fields in the record of the CompressedVectorNode are required to be read at one time.
A class invariant is a list of statements about an object that are always true before and after any operation on the object. An invariant is useful for testing correct operation of an implementation. Statements in an invariant can involve only externally visible state, or can refer to internal implementation-specific state that is not visible to the API user. The following C++ code checks externally visible state for consistency and throws an exception if the invariant is violated:
|
delete |
void CompressedVectorReader::checkInvariant | ( | bool | doRecurse = true | ) |
Check whether CompressedVectorReader class invariant is true.
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 ErrorInvarianceViolation E57Exception is thrown.
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.
ErrorInternal | All objects in undocumented state |
CompressedVectorNode CompressedVectorReader::compressedVectorNode | ( | ) | const |
Return the CompressedVectorNode being read.
It is not an error if this CompressedVectorReader is closed.
ErrorImageFileNotOpen | |
ErrorInternal | All objects in undocumented state |
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.
[in] | indent | Number of spaces to indent all the printed lines of this object. |
[in] | os | Output 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.
No | E57Exceptions |
bool CompressedVectorReader::isOpen | ( | ) |
Test whether CompressedVectorReader is still open for reading.
ErrorImageFileNotOpen | |
ErrorInternal | All objects in undocumented state |
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.
ErrorImageFileNotOpen | |
ErrorReaderNotOpen | |
ErrorConversionRequired | This CompressedVectorReader in undocumented state |
ErrorValueNotRepresentable | This CompressedVectorReader in undocumented state |
ErrorScaledValueNotRepresentable | This CompressedVectorReader in undocumented state |
ErrorReal64TooLarge | This CompressedVectorReader in undocumented state |
ErrorExpectingNumeric | This CompressedVectorReader in undocumented state |
ErrorExpectingUString | This CompressedVectorReader in undocumented state |
ErrorBadCVPacket | This CompressedVectorReader, associated ImageFile in undocumented state |
ErrorSeekFailed | This CompressedVectorReader, associated ImageFile in undocumented state |
ErrorReadFailed | This CompressedVectorReader, associated ImageFile in undocumented state |
ErrorBadChecksum | This CompressedVectorReader, associated ImageFile in undocumented state |
ErrorInternal | All objects in undocumented state |
unsigned CompressedVectorReader::read | ( | std::vector< SourceDestBuffer > & | dbufs | ) |
Request transfer of block of data from CompressedVectorNode into given destination buffers.
[in] | dbufs | Vector 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.
ErrorImageFileNotOpen | |
ErrorReaderNotOpen | |
ErrorPathUndefined | |
ErrorBufferSizeMismatch | |
ErrorBufferDuplicatePathName | |
ErrorConversionRequired | This CompressedVectorReader in undocumented state |
ErrorValueNotRepresentable | This CompressedVectorReader in undocumented state |
ErrorScaledValueNotRepresentable | This CompressedVectorReader in undocumented state |
ErrorReal64TooLarge | This CompressedVectorReader in undocumented state |
ErrorExpectingNumeric | This CompressedVectorReader in undocumented state |
ErrorExpectingUString | This CompressedVectorReader in undocumented state |
ErrorBadCVPacket | This CompressedVectorReader, associated ImageFile in undocumented state |
ErrorSeekFailed | This CompressedVectorReader, associated ImageFile in undocumented state |
ErrorReadFailed | This CompressedVectorReader, associated ImageFile in undocumented state |
ErrorBadChecksum | This CompressedVectorReader, associated ImageFile in undocumented state |
ErrorInternal | All objects in undocumented state |
void CompressedVectorReader::seek | ( | int64_t | recordNumber | ) |
Set record number of CompressedVectorNode where next read will start.
[in] | recordNumber | The index of record in CompressedVectorNode 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).
ErrorBadAPIArgument | |
ErrorImageFileNotOpen | |
ErrorReaderNotOpen | |
ErrorBadCVPacket | |
ErrorSeekFailed | |
ErrorReadFailed | |
ErrorBadChecksum | |
ErrorInternal | All objects in undocumented state |