Class ICziWriter#

Class Documentation#

class ICziWriter#

This interface is used in order to write a CZI-file. The sequence of operations is: the object is initialized by calling the Create-method. Then use SyncAddSubBlock, SyncAddAttachment and SyncWriteMetadata to put data into the document. Finally, call Close which will finalized the document. Note that this object is not thread-safe. Calls into any of the functions must be synchronized, i. e. at no point in time we may execute different methods (or the same method for that matter) concurrently. The class by itself does not guard itself against concurrent execution.

Public Functions

virtual void Create(std::shared_ptr<IOutputStream> stream, std::shared_ptr<ICziWriterInfo> info) = 0#

Initialize the writer by passing in the output-stream-object.

Remark

If this method is called twice, then an exception of type std::logic_error is thrown.

Parameters:
  • stream – The stream-object.

  • info – Settings for document-creation. May be null.

virtual void SyncAddSubBlock(const AddSubBlockInfo &addSbBlkInfo) = 0#

Adds the specified subblock to the CZI-file. This is a synchronous method, meaning that it will return when all data has been written out to the file AND that it must not be called concurrently with other method-invocations of this object. If there are bounds specified (with the ‘info’-argument to ‘Create’) then the coordinate is checked against the bounds. In case of any error, an exception is thrown.

Parameters:

addSbBlkInfo – Information describing the subblock to be added.

virtual void SyncAddAttachment(const AddAttachmentInfo &addAttachmentInfo) = 0#

Adds the specified attachment to the CZI-file. This is a synchronous method, meaning that it will return when all data has been written out to the file AND that it must not be called concurrently with other method-invocations of this object.

Parameters:

addAttachmentInfo – Information describing attachment to be added.

virtual void SyncWriteMetadata(const WriteMetadataInfo &metadataInfo) = 0#

Adds the specified metadata to the CZI-file. This is a synchronous method, meaning that it will return when all data has been written out to the file AND that it must not be called concurrently with other method-invocations of this object.

Parameters:

metadataInfo – Information describing the metadata to be added.

virtual std::shared_ptr<libCZI::ICziMetadataBuilder> GetPreparedMetadata(const PrepareMetadataInfo &info) = 0#

Gets a “pre-filled” metadata object. This metadata object contains the information which is already known by the writer.

Parameters:

info – Information controlling the operation.

Returns:

The “pre-filled” metadata object if successful.

virtual void Close() = 0#

Finalizes the CZI (i.e. writes out the final directory-segments) and closes the file. Note that this method must be called explicitly in order to get a valid CZI - calling the destructor alone will close the file immediately without finalization.

virtual libCZI::SubBlockStatistics GetStatistics() const = 0#

Gets the statistics about the sub-blocks. This statistics is aggregated from the subblocks as they are added.

Returns:

The sub-block statistics.

virtual ~ICziWriter() = default#
void SyncAddSubBlock(const AddSubBlockInfoMemPtr &addSbBlkInfo)#

This helper method uses the structure ‘AddSubBlockInfoMemPtr’ in order to describe the subblock to be added. What it does is to cast the parameters into the form required by the ICziWriter::SyncAddSubBlock method and call it.

Parameters:

addSbBlkInfo – Information describing the subblock to be added.

void SyncAddSubBlock(const libCZI::AddSubBlockInfoLinewiseBitmap &addSbInfoLinewise)#

This helper method uses the structure ‘AddSubBlockInfoLinewiseBitmap’ in order to describe the subblock to be added. What it does is to cast the parameters into the form required by the ICziWriter::SyncAddSubBlock method and call it.

Parameters:

addSbInfoLinewise – Information describing the subblock to be added.

void SyncAddSubBlock(const AddSubBlockInfoStridedBitmap &addSbBlkInfoStrideBitmap)#

This helper method uses the structure ‘AddSubBlockInfoStridedBitmap’ in order to describe the subblock to be added. What it does is to cast the parameters into the form required by the ICziWriter::SyncAddSubBlock method and call it.

Parameters:

addSbBlkInfoStrideBitmap – Information describing the subblock to be added.