libCZI
Reading and Writing CZI documents made easy
Loading...
Searching...
No Matches
libCZI_ReadWrite.h
1// SPDX-FileCopyrightText: 2017-2022 Carl Zeiss Microscopy GmbH
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#pragma once
6
7#include <memory>
8#include "libCZI.h"
9
10namespace libCZI
11{
13 class LIBCZI_API ICziReaderWriterInfo
14 {
15 public:
19 virtual bool GetForceFileGuid() const = 0;
20
24 virtual const GUID& GetFileGuid() const = 0;
25
33
34 virtual ~ICziReaderWriterInfo() = default;
35 };
36
48 {
49 public:
54 virtual void Create(std::shared_ptr<IInputOutputStream> stream, std::shared_ptr<ICziReaderWriterInfo> info = nullptr) = 0;
55
60 virtual void ReplaceSubBlock(int key, const AddSubBlockInfo& addSbBlkInfo) = 0;
61
65 virtual void RemoveSubBlock(int key) = 0;
66
71 virtual void ReplaceAttachment(int attchmntId, const AddAttachmentInfo& addAttachmentInfo) = 0;
72
76 virtual void RemoveAttachment(int attchmntId) = 0;
77
81 virtual void SyncAddSubBlock(const AddSubBlockInfo& addSbBlkInfo) = 0;
82
86 virtual void SyncAddAttachment(const AddAttachmentInfo& addAttachmentInfo) = 0;
87
91 virtual void SyncWriteMetadata(const WriteMetadataInfo& metadataInfo) = 0;
92
96 virtual std::shared_ptr<IMetadataSegment> ReadMetadataSegment() = 0;
97
101
105 virtual void Close() = 0;
106
107 ~ICziReaderWriter() override = default;
108
114 void SyncAddSubBlock(const libCZI::AddSubBlockInfoMemPtr& addSbBlkInfoMemPtr);
115
122
128 void SyncAddSubBlock(const libCZI::AddSubBlockInfoStridedBitmap& addSbBlkInfoStrideBitmap);
129
136 void ReplaceSubBlock(int key, const libCZI::AddSubBlockInfoMemPtr& addSbBlkInfoMemPtr);
137
144 void ReplaceSubBlock(int key, const libCZI::AddSubBlockInfoLinewiseBitmap& addSbInfoLinewise);
145
152 void ReplaceSubBlock(int key, const libCZI::AddSubBlockInfoStridedBitmap& addSbBlkInfoStrideBitmap);
153 };
154
157 {
158 private:
159 bool forceFileGuid;
160 GUID fileGuid;
161 libCZI::CZIFrameOfReference defaultFrameOfReference;
162 public:
164 CCziReaderWriterInfo() : CCziReaderWriterInfo(GUID{ 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 } })
165 {}
166
170 explicit CCziReaderWriterInfo(const GUID& fileGuid) : forceFileGuid(false), fileGuid(fileGuid), defaultFrameOfReference(libCZI::CZIFrameOfReference::Invalid)
171 {}
172
174 bool GetForceFileGuid() const override { return this->forceFileGuid; }
175
177 const GUID& GetFileGuid() const override { return this->fileGuid; }
178
180 libCZI::CZIFrameOfReference GetDefaultFrameOfReference() const override { return this->defaultFrameOfReference; }
181
185 void SetForceFileGuid(bool forceFileGuid) { this->forceFileGuid = forceFileGuid; }
186 };
187}
An implementation of the ICziReaderWriterInfo-interface.
Definition libCZI_ReadWrite.h:157
bool GetForceFileGuid() const override
Definition libCZI_ReadWrite.h:174
void SetForceFileGuid(bool forceFileGuid)
Definition libCZI_ReadWrite.h:185
CCziReaderWriterInfo()
Default constructor - sets all information to "invalid" and sets fileGuid to GUID_NULL.
Definition libCZI_ReadWrite.h:164
const GUID & GetFileGuid() const override
Definition libCZI_ReadWrite.h:177
CCziReaderWriterInfo(const GUID &fileGuid)
Definition libCZI_ReadWrite.h:170
libCZI::CZIFrameOfReference GetDefaultFrameOfReference() const override
Definition libCZI_ReadWrite.h:180
Interface for the attachment repository. This interface is used to access the attachments in a CZI-fi...
Definition libCZI.h:631
Definition libCZI_ReadWrite.h:48
virtual void ReplaceAttachment(int attchmntId, const AddAttachmentInfo &addAttachmentInfo)=0
void SyncAddSubBlock(const libCZI::AddSubBlockInfoMemPtr &addSbBlkInfoMemPtr)
virtual void ReplaceSubBlock(int key, const AddSubBlockInfo &addSbBlkInfo)=0
void ReplaceSubBlock(int key, const libCZI::AddSubBlockInfoLinewiseBitmap &addSbInfoLinewise)
virtual void RemoveAttachment(int attchmntId)=0
void SyncAddSubBlock(const libCZI::AddSubBlockInfoLinewiseBitmap &addSbInfoLinewise)
void ReplaceSubBlock(int key, const libCZI::AddSubBlockInfoStridedBitmap &addSbBlkInfoStrideBitmap)
void SyncAddSubBlock(const libCZI::AddSubBlockInfoStridedBitmap &addSbBlkInfoStrideBitmap)
virtual void Create(std::shared_ptr< IInputOutputStream > stream, std::shared_ptr< ICziReaderWriterInfo > info=nullptr)=0
virtual void SyncWriteMetadata(const WriteMetadataInfo &metadataInfo)=0
void ReplaceSubBlock(int key, const libCZI::AddSubBlockInfoMemPtr &addSbBlkInfoMemPtr)
virtual void SyncAddSubBlock(const AddSubBlockInfo &addSbBlkInfo)=0
virtual std::shared_ptr< IMetadataSegment > ReadMetadataSegment()=0
virtual void SyncAddAttachment(const AddAttachmentInfo &addAttachmentInfo)=0
virtual void RemoveSubBlock(int key)=0
virtual void Close()=0
virtual FileHeaderInfo GetFileHeaderInfo()=0
Options for the CziReaderWriter.
Definition libCZI_ReadWrite.h:14
virtual const GUID & GetFileGuid() const =0
virtual bool GetForceFileGuid() const =0
virtual libCZI::CZIFrameOfReference GetDefaultFrameOfReference() const =0
Interface for sub-block repository. This interface is used to access the sub-blocks in a CZI-file.
Definition libCZI.h:534
External interfaces, classes, functions and structs are found in the namespace "libCZI".
Definition libCZI.h:31
CZIFrameOfReference
Values that represent different frame of reference.
Definition libCZI_Pixels.h:86
@ Invalid
Invalid frame of reference.
This struct describes an attachment to be added to a CZI-file.
Definition libCZI_Write.h:341
Definition libCZI_Write.h:228
Definition libCZI_Write.h:320
Definition libCZI_Write.h:274
Definition libCZI_Write.h:297
Global information about the CZI-file (from the CZI-fileheader-segment).
Definition libCZI.h:662
Represents a globally unique identifier (GUID) consisting of four unsigned 32-bit integers.
Definition libCZI_Utilities.h:25
This struct defines the data to be added as metadata-segment. Unused entries (e. g....
Definition libCZI_Write.h:379