Class ICziReaderWriter#

Inheritance Relationships#

Base Types#

Class Documentation#

class ICziReaderWriter : public libCZI::ISubBlockRepository, public libCZI::IAttachmentRepository#

Interface for “in-place-editing” of a CZI. All write-operations immediately go into the file. If the data does not fit into the existing segments, a new segment is appended at the end (and the existing one is marked “DELETED”). All operation is strictly single-threaded. Only exactly one method may be executing at a given point in time. Notes:

  • The indices (or “keys”) for a subblock/attachment do not change during the lifetime of the object (even if deleting some).

  • Contrary to ICziWriter

    , this object does not attempt to verify the consistency of the coordinates - which is due the fact

    that we aim at allowing arbitrary modifications. We do not require to specify in advance the number of dimensions or the bounds.

  • The information returned by ISubBlockRepository::GetStatistics is valid (taking into consideration the current state).

  • When enumerating subblocks/attachments, mutations (i.e. adding/removing items) of the respective subblock/attachment-collection are not allowed

    and result in undefined behavior.

Public Functions

virtual void Create(std::shared_ptr<IInputOutputStream> stream, std::shared_ptr<ICziReaderWriterInfo> info = nullptr) = 0#

Initialize the object.

Parameters:
  • stream – The read-write stream to operate on.

  • info – (Optional) Parameters controlling the operation.

virtual void ReplaceSubBlock(int key, const AddSubBlockInfo &addSbBlkInfo) = 0#

Replace an existing subblock. The subblock is identified by an index (as reported by ISubBlockRepository::EnumerateSubBlocks).

Parameters:
virtual void RemoveSubBlock(int key) = 0#

Removes the specified subblock. Physically, it is marked as “DELETED”.

Parameters:

key – The key (as retrieved by ISubBlockRepository::EnumerateSubBlocks).

virtual void ReplaceAttachment(int attchmntId, const AddAttachmentInfo &addAttachmentInfo) = 0#

Replace an existing attachment. The attachment is identified by an index (as reported by IAttachmentRepository::EnumerateAttachments).

Parameters:
virtual void RemoveAttachment(int attchmntId) = 0#

Removes the specified attachment. Physically, it is marked as “DELETED”.

Parameters:

attchmntId – Identifier for the attachmnt (as reported by IAttachmentRepository::EnumerateAttachments).

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

Adds the specified subblock to the CZI-file.

Parameters:

addSbBlkInfo – Information describing the subblock to be added.

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

Adds the specified attachment to the CZI-file.

Parameters:

addAttachmentInfo – Information describing the attachment to be added.

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

Write metadata segment.

Parameters:

metadataInfo – Information describing the metadata.

virtual std::shared_ptr<IMetadataSegment> ReadMetadataSegment() = 0#

Reads the metadata-segment from the stream. If no metadata-segment is present, then an empty shared_ptr is returned.

Returns:

The metadata segment if successful, otherwise an empty shared_ptr is returned.

virtual FileHeaderInfo GetFileHeaderInfo() = 0#

Gets the file header information.

Returns:

The file header information.

virtual void Close() = 0#

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

~ICziReaderWriter() override = default#
void SyncAddSubBlock(const libCZI::AddSubBlockInfoMemPtr &addSbBlkInfoMemPtr)#

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 ICziReaderWriterInfo::SyncAddSubBlock method and call it.

Parameters:

addSbBlkInfoMemPtr – 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 ICziReaderWriterInfo::SyncAddSubBlock method and call it.

Parameters:

addSbInfoLinewise – Information describing the subblock to be added.

void SyncAddSubBlock(const libCZI::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 ICziReaderWriterInfo::SyncAddSubBlock method and call it.

Parameters:

addSbBlkInfoStrideBitmap – Information describing the subblock to be added.

void ReplaceSubBlock(int key, const libCZI::AddSubBlockInfoMemPtr &addSbBlkInfoMemPtr)#

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

Parameters:
  • key – The key identifying the subblock to be replaced.

  • addSbBlkInfoMemPtr – Information describing the subblock to be added.

void ReplaceSubBlock(int key, const libCZI::AddSubBlockInfoLinewiseBitmap &addSbInfoLinewise)#

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

Parameters:
  • key – The key identifying the subblock to be replaced.

  • addSbInfoLinewise – Information describing the subblock to be added.

void ReplaceSubBlock(int key, const libCZI::AddSubBlockInfoStridedBitmap &addSbBlkInfoStrideBitmap)#

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

Parameters:
  • key – The key identifying the subblock to be replaced.

  • addSbBlkInfoStrideBitmap – Information describing the subblock to be added.