e57::CompressedVectorWriter Class Reference

#include <E57Format.h>

Public Member Functions

void checkInvariant (bool doRecurse=true)
 Check whether CompressedVectorWriter class invariant is true. More...
 
void close ()
 End the write operation. More...
 
CompressedVectorNode compressedVectorNode () const
 Return the CompressedVectorNode being written to. More...
 
 CompressedVectorWriter ()=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 CompressedVectorWriter is still open for writing. More...
 
void write (const size_t recordCount)
 Request transfer of blocks of data to CompressedVectorNode from previously designated source buffers. More...
 
void write (std::vector< SourceDestBuffer > &sbufs, const size_t recordCount)
 Request transfer of block of data to CompressedVectorNode from given source buffers. More...
 

Constructor & Destructor Documentation

◆ CompressedVectorWriter()

e57::CompressedVectorWriter::CompressedVectorWriter ( )
delete

Member Function Documentation

◆ checkInvariant()

void CompressedVectorWriter::checkInvariant ( bool  doRecurse = true)

Check whether CompressedVectorWriter 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::isWritable(), e57::ImageFile::readerCount(), and e57::ImageFile::writerCount().

◆ close()

void CompressedVectorWriter::close ( )

End the write operation.

This function must be called to safely and gracefully end a transfer to a CompressedVectorNode. This is required because errors cannot be communicated from the CompressedVectorNode destructor (in C++ destructors can't throw exceptions). It is not an error to call this function if the CompressedVectorWriter is already closed. This function will cause the CompressedVectorWriter to enter the closed state, and any further transfers requests will fail.

Warning: If this function is not called before the CompressedVectorWriter destructor is invoked, all writes to the CompressedVectorNode will be lost (it will have zero children).

Precondition
The associated ImageFile must be open.
Postcondition
This CompressedVectorWriter is closed (i.e !isOpen())
Exceptions
E57_ERROR_IMAGEFILE_NOT_OPEN
E57_ERROR_LSEEK_FAILEDThis CompressedVectorWriter, associated ImageFile in undocumented state
E57_ERROR_READ_FAILEDThis CompressedVectorWriter, associated ImageFile in undocumented state
E57_ERROR_WRITE_FAILEDThis CompressedVectorWriter, associated ImageFile in undocumented state
E57_ERROR_BAD_CHECKSUMThis CompressedVectorWriter, associated ImageFile in undocumented state
E57_ERROR_INTERNALAll objects in undocumented state
See also
CompressedVectorWriter::isOpen

Referenced by femexamples.examplesgui.FemExamples::reject(), and e57::WriterImpl::WriteData3DGroupsData().

◆ compressedVectorNode()

CompressedVectorNode CompressedVectorWriter::compressedVectorNode ( ) const

Return the CompressedVectorNode being written to.

Precondition
The associated ImageFile must be open.
Returns
A smart CompressedVectorNode handle referencing the underlying object being written to.
Exceptions
E57_ERROR_IMAGEFILE_NOT_OPEN
E57_ERROR_INTERNALAll objects in undocumented state
See also
CompressedVectorNode::writer

Referenced by checkInvariant().

◆ dump()

void CompressedVectorWriter::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 CompressedVectorWriter::isOpen ( )

Test whether CompressedVectorWriter is still open for writing.

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

Referenced by checkInvariant().

◆ write() [1/2]

void CompressedVectorWriter::write ( const size_t  recordCount)

Request transfer of blocks of data to CompressedVectorNode from previously designated source buffers.

Parameters
[in]recordCountNumber of records to write.

The SourceDestBuffers used are previously designated either in CompressedVectorNode::writer where this object was created, or in the last call to CompressedVectorWriter::write(std::vector<SourceDestBuffer>&, unsigned) where new buffers were designated.

If a conversion or bounds error occurs during the transfer, the CompressedVectorWriter is left in an undocumented state (it can't be used any further), and all previously written records are deleted from the associated CompressedVectorNode which will then have zero children. If a file I/O or checksum error occurs during the transfer, both this CompressedVectorWriter and the associated ImageFile are left in an undocumented state (they can't be used any further). If CompressedVectorWriter::close is not called before the CompressedVectorWriter destructor is invoked, all writes to the CompressedVectorNode will be lost (it will have zero children).

Precondition
The associated ImageFile must be open.
This CompressedVectorWriter must be open (i.e isOpen())
Exceptions
E57_ERROR_BAD_API_ARGUMENT
E57_ERROR_IMAGEFILE_NOT_OPEN
E57_ERROR_WRITER_NOT_OPEN
E57_ERROR_PATH_UNDEFINED
E57_ERROR_NO_BUFFER_FOR_ELEMENT
E57_ERROR_BUFFER_SIZE_MISMATCH
E57_ERROR_BUFFER_DUPLICATE_PATHNAME
E57_ERROR_CONVERSION_REQUIREDThis CompressedVectorWriter in undocumented state, associated CompressedVectorNode modified but consistent, associated ImageFile modified but consistent.
E57_ERROR_VALUE_OUT_OF_BOUNDSThis CompressedVectorWriter in undocumented state, associated CompressedVectorNode modified but consistent, associated ImageFile modified but consistent.
E57_ERROR_VALUE_NOT_REPRESENTABLEThis CompressedVectorWriter in undocumented state, associated CompressedVectorNode modified but consistent, associated ImageFile modified but consistent.
E57_ERROR_SCALED_VALUE_NOT_REPRESENTABLEThis CompressedVectorWriter in undocumented state, associated CompressedVectorNode modified but consistent, associated ImageFile modified but consistent.
E57_ERROR_REAL64_TOO_LARGEThis CompressedVectorWriter in undocumented state, associated CompressedVectorNode modified but consistent, associated ImageFile modified but consistent.
E57_ERROR_EXPECTING_NUMERICThis CompressedVectorWriter in undocumented state, associated CompressedVectorNode modified but consistent, associated ImageFile modified but consistent.
E57_ERROR_EXPECTING_USTRINGThis CompressedVectorWriter in undocumented state, associated CompressedVectorNode modified but consistent, associated ImageFile modified but consistent.
E57_ERROR_LSEEK_FAILEDThis CompressedVectorWriter, associated ImageFile in undocumented state
E57_ERROR_READ_FAILEDThis CompressedVectorWriter, associated ImageFile in undocumented state
E57_ERROR_WRITE_FAILEDThis CompressedVectorWriter, associated ImageFile in undocumented state
E57_ERROR_BAD_CHECKSUMThis CompressedVectorWriter, associated ImageFile in undocumented state
E57_ERROR_INTERNALAll objects in undocumented state
See also
CompressedVectorWriter::write(std::vector<SourceDestBuffer>&,unsigned), CompressedVectorNode::writer, CompressedVectorWriter::close, SourceDestBuffer, E57Exception

Referenced by gzip_utf8.GzipFile::seek(), and e57::WriterImpl::WriteData3DGroupsData().

◆ write() [2/2]

void CompressedVectorWriter::write ( std::vector< SourceDestBuffer > &  sbufs,
const size_t  recordCount 
)

Request transfer of block of data to CompressedVectorNode from given source buffers.

Parameters
[in]sbufsVector of memory buffers that hold data to be written to a CompressedVectorNode.
[in]recordCountNumber of records to write.

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

The sbufs locations are saved so that a later call to CompressedVectorWriter::write(unsigned) can be used without having to re-specify the SourceDestBuffers.

If a conversion or bounds error occurs during the transfer, the CompressedVectorWriter is left in an undocumented state (it can't be used any further), and all previously written records are deleted from the the associated CompressedVectorNode which will then have zero children. If a file I/O or checksum error occurs during the transfer, both this CompressedVectorWriter and the associated ImageFile are left in an undocumented state (they can't be used any further).

Warning: If CompressedVectorWriter::close is not called before the CompressedVectorWriter destructor is invoked, all writes to the CompressedVectorNode will be lost (it will have zero children).

Precondition
The associated ImageFile must be open.
This CompressedVectorWriter must be open (i.e isOpen())
Exceptions
E57_ERROR_BAD_API_ARGUMENT
E57_ERROR_IMAGEFILE_NOT_OPEN
E57_ERROR_WRITER_NOT_OPEN
E57_ERROR_PATH_UNDEFINED
E57_ERROR_NO_BUFFER_FOR_ELEMENT
E57_ERROR_BUFFER_SIZE_MISMATCH
E57_ERROR_BUFFER_DUPLICATE_PATHNAME
E57_ERROR_CONVERSION_REQUIREDThis CompressedVectorWriter in undocumented state, associated ImageFile modified but consistent.
E57_ERROR_VALUE_OUT_OF_BOUNDSThis CompressedVectorWriter in undocumented state, associated ImageFile modified but consistent.
E57_ERROR_VALUE_NOT_REPRESENTABLEThis CompressedVectorWriter in undocumented state, associated ImageFile modified but consistent.
E57_ERROR_SCALED_VALUE_NOT_REPRESENTABLEThis CompressedVectorWriter in undocumented state, associated ImageFile modified but consistent.
E57_ERROR_REAL64_TOO_LARGEThis CompressedVectorWriter in undocumented state, associated ImageFile modified but consistent.
E57_ERROR_EXPECTING_NUMERICThis CompressedVectorWriter in undocumented state, associated ImageFile modified but consistent.
E57_ERROR_EXPECTING_USTRINGThis CompressedVectorWriter in undocumented state, associated ImageFile modified but consistent.
E57_ERROR_LSEEK_FAILEDThis CompressedVectorWriter, associated ImageFile in undocumented state
E57_ERROR_READ_FAILEDThis CompressedVectorWriter, associated ImageFile in undocumented state
E57_ERROR_WRITE_FAILEDThis CompressedVectorWriter, associated ImageFile in undocumented state
E57_ERROR_BAD_CHECKSUMThis CompressedVectorWriter, associated ImageFile in undocumented state
E57_ERROR_INTERNALAll objects in undocumented state
See also
CompressedVectorWriter::write(unsigned), CompressedVectorNode::writer, CompressedVectorWriter::close, SourceDestBuffer, E57Exception

Referenced by gzip_utf8.GzipFile::seek().


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