libCZI
Reading and Writing CZI documents made easy
libCZI::ICziReaderWriter Class Referenceabstract

#include <libCZI_ReadWrite.h>

Inheritance diagram for libCZI::ICziReaderWriter:
libCZI::ISubBlockRepository libCZI::IAttachmentRepository

Public Member Functions

virtual void Create (std::shared_ptr< IInputOutputStream > stream, std::shared_ptr< ICziReaderWriterInfo > info=nullptr)=0
 
virtual void ReplaceSubBlock (int key, const AddSubBlockInfo &addSbBlkInfo)=0
 
virtual void RemoveSubBlock (int key)=0
 
virtual void ReplaceAttachment (int attchmntId, const AddAttachmentInfo &addAttachmentInfo)=0
 
virtual void RemoveAttachment (int attchmntId)=0
 
virtual void SyncAddSubBlock (const AddSubBlockInfo &addSbBlkInfo)=0
 
virtual void SyncAddAttachment (const AddAttachmentInfo &addAttachmentInfo)=0
 
virtual void SyncWriteMetadata (const WriteMetadataInfo &metadataInfo)=0
 
virtual std::shared_ptr< IMetadataSegmentReadMetadataSegment ()=0
 
virtual FileHeaderInfo GetFileHeaderInfo ()=0
 
virtual void Close ()=0
 
void SyncAddSubBlock (const libCZI::AddSubBlockInfoMemPtr &addSbBlkInfoMemPtr)
 
void SyncAddSubBlock (const libCZI::AddSubBlockInfoLinewiseBitmap &addSbInfoLinewise)
 
void SyncAddSubBlock (const libCZI::AddSubBlockInfoStridedBitmap &addSbBlkInfoStrideBitmap)
 
void ReplaceSubBlock (int key, const libCZI::AddSubBlockInfoMemPtr &addSbBlkInfoMemPtr)
 
void ReplaceSubBlock (int key, const libCZI::AddSubBlockInfoLinewiseBitmap &addSbInfoLinewise)
 
void ReplaceSubBlock (int key, const libCZI::AddSubBlockInfoStridedBitmap &addSbBlkInfoStrideBitmap)
 
- Public Member Functions inherited from libCZI::ISubBlockRepository
virtual void EnumerateSubBlocks (const std::function< bool(int index, const SubBlockInfo &info)> &funcEnum)=0
 
virtual void EnumSubset (const IDimCoordinate *planeCoordinate, const IntRect *roi, bool onlyLayer0, const std::function< bool(int index, const SubBlockInfo &info)> &funcEnum)=0
 
virtual std::shared_ptr< ISubBlockReadSubBlock (int index)=0
 
virtual bool TryGetSubBlockInfoOfArbitrarySubBlockInChannel (int channelIndex, SubBlockInfo &info)=0
 
virtual bool TryGetSubBlockInfo (int index, SubBlockInfo *info) const =0
 
virtual SubBlockStatistics GetStatistics ()=0
 
virtual PyramidStatistics GetPyramidStatistics ()=0
 
- Public Member Functions inherited from libCZI::IAttachmentRepository
virtual void EnumerateAttachments (const std::function< bool(int index, const AttachmentInfo &info)> &funcEnum)=0
 
virtual void EnumerateSubset (const char *contentFileType, const char *name, const std::function< bool(int index, const AttachmentInfo &info)> &funcEnum)=0
 
virtual std::shared_ptr< IAttachmentReadAttachment (int index)=0
 

Detailed Description

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.

Member Function Documentation

◆ Close()

virtual void libCZI::ICziReaderWriter::Close ( )
pure virtual

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.

◆ Create()

virtual void libCZI::ICziReaderWriter::Create ( std::shared_ptr< IInputOutputStream stream,
std::shared_ptr< ICziReaderWriterInfo info = nullptr 
)
pure virtual

Initialize the object.

Parameters
streamThe read-write stream to operate on.
info(Optional) Parameters controlling the operation.

◆ GetFileHeaderInfo()

virtual FileHeaderInfo libCZI::ICziReaderWriter::GetFileHeaderInfo ( )
pure virtual

Gets the file header information.

Returns
The file header information.

◆ ReadMetadataSegment()

virtual std::shared_ptr<IMetadataSegment> libCZI::ICziReaderWriter::ReadMetadataSegment ( )
pure virtual

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.

◆ RemoveAttachment()

virtual void libCZI::ICziReaderWriter::RemoveAttachment ( int  attchmntId)
pure virtual

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

Parameters
attchmntIdIdentifier for the attachmnt (as reported by IAttachmentRepository::EnumerateAttachments).

◆ RemoveSubBlock()

virtual void libCZI::ICziReaderWriter::RemoveSubBlock ( int  key)
pure virtual

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

Parameters
keyThe key (as retrieved by ISubBlockRepository::EnumerateSubBlocks).

◆ ReplaceAttachment()

virtual void libCZI::ICziReaderWriter::ReplaceAttachment ( int  attchmntId,
const AddAttachmentInfo addAttachmentInfo 
)
pure virtual

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

Parameters
attchmntIdIdentifier for the attachmnt (as reported by IAttachmentRepository::EnumerateAttachments).
addAttachmentInfoInformation describing attachment to be added.

◆ ReplaceSubBlock() [1/4]

virtual void libCZI::ICziReaderWriter::ReplaceSubBlock ( int  key,
const AddSubBlockInfo addSbBlkInfo 
)
pure virtual

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

Parameters
keyThe key (as retrieved by ISubBlockRepository::EnumerateSubBlocks).
addSbBlkInfoInformation describing the subblock to be added.

◆ ReplaceSubBlock() [2/4]

void libCZI::ICziReaderWriter::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
keyThe key identifying the subblock to be replaced.
addSbInfoLinewiseInformation describing the subblock to be added.

◆ ReplaceSubBlock() [3/4]

void libCZI::ICziReaderWriter::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
keyThe key identifying the subblock to be replaced.
addSbBlkInfoMemPtrInformation describing the subblock to be added.

◆ ReplaceSubBlock() [4/4]

void libCZI::ICziReaderWriter::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
keyThe key identifying the subblock to be replaced.
addSbBlkInfoStrideBitmapInformation describing the subblock to be added.

◆ SyncAddAttachment()

virtual void libCZI::ICziReaderWriter::SyncAddAttachment ( const AddAttachmentInfo addAttachmentInfo)
pure virtual

Adds the specified attachment to the CZI-file.

Parameters
addAttachmentInfoInformation describing the attachment to be added.

◆ SyncAddSubBlock() [1/4]

virtual void libCZI::ICziReaderWriter::SyncAddSubBlock ( const AddSubBlockInfo addSbBlkInfo)
pure virtual

Adds the specified subblock to the CZI-file.

Parameters
addSbBlkInfoInformation describing the subblock to be added.

◆ SyncAddSubBlock() [2/4]

void libCZI::ICziReaderWriter::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
addSbInfoLinewiseInformation describing the subblock to be added.

◆ SyncAddSubBlock() [3/4]

void libCZI::ICziReaderWriter::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
addSbBlkInfoMemPtrInformation describing the subblock to be added.

◆ SyncAddSubBlock() [4/4]

void libCZI::ICziReaderWriter::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
addSbBlkInfoStrideBitmapInformation describing the subblock to be added.

◆ SyncWriteMetadata()

virtual void libCZI::ICziReaderWriter::SyncWriteMetadata ( const WriteMetadataInfo metadataInfo)
pure virtual

Write metadata segment.

Parameters
metadataInfoInformation describing the metadata.

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