libCZI
Reading and Writing CZI documents made easy
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 
10 namespace 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 
26  virtual ~ICziReaderWriterInfo() {}
27  };
28 
40  {
41  public:
42 
47  virtual void Create(std::shared_ptr<IInputOutputStream> stream, std::shared_ptr<ICziReaderWriterInfo> info = nullptr) = 0;
48 
53  virtual void ReplaceSubBlock(int key, const AddSubBlockInfo& addSbBlkInfo) = 0;
54 
58  virtual void RemoveSubBlock(int key) = 0;
59 
64  virtual void ReplaceAttachment(int attchmntId, const AddAttachmentInfo& addAttachmentInfo) = 0;
65 
69  virtual void RemoveAttachment(int attchmntId) = 0;
70 
74  virtual void SyncAddSubBlock(const AddSubBlockInfo& addSbBlkInfo) = 0;
75 
79  virtual void SyncAddAttachment(const AddAttachmentInfo& addAttachmentInfo) = 0;
80 
84  virtual void SyncWriteMetadata(const WriteMetadataInfo& metadataInfo) = 0;
85 
89  virtual std::shared_ptr<IMetadataSegment> ReadMetadataSegment() = 0;
90 
94 
98  virtual void Close() = 0;
99 
100  ~ICziReaderWriter() override = default;
101 
107  void SyncAddSubBlock(const libCZI::AddSubBlockInfoMemPtr& addSbBlkInfoMemPtr);
108 
115 
121  void SyncAddSubBlock(const libCZI::AddSubBlockInfoStridedBitmap& addSbBlkInfoStrideBitmap);
122 
129  void ReplaceSubBlock(int key, const libCZI::AddSubBlockInfoMemPtr& addSbBlkInfoMemPtr);
130 
137  void ReplaceSubBlock(int key, const libCZI::AddSubBlockInfoLinewiseBitmap& addSbInfoLinewise);
138 
145  void ReplaceSubBlock(int key, const libCZI::AddSubBlockInfoStridedBitmap& addSbBlkInfoStrideBitmap);
146  };
147 
150  {
151  private:
152  bool forceFileGuid;
153  GUID fileGuid;
154  public:
156  CCziReaderWriterInfo() : CCziReaderWriterInfo(GUID{ 0,0,0,{ 0,0,0,0,0,0,0,0 } })
157  {}
158 
162  explicit CCziReaderWriterInfo(const GUID& fileGuid) : forceFileGuid(false)
163  {
164  this->fileGuid = fileGuid;
165  }
166 
167  bool GetForceFileGuid() const override { return this->forceFileGuid; }
168  const GUID& GetFileGuid() const override { return this->fileGuid; }
169 
173  void SetForceFileGuid(bool forceFileGuid) { this->forceFileGuid = forceFileGuid; }
174  };
175 }
An implementation of the ICziReaderWriterInfo-interface.
Definition: libCZI_ReadWrite.h:150
bool GetForceFileGuid() const override
Definition: libCZI_ReadWrite.h:167
void SetForceFileGuid(bool forceFileGuid)
Definition: libCZI_ReadWrite.h:173
const GUID & GetFileGuid() const override
Definition: libCZI_ReadWrite.h:168
CCziReaderWriterInfo()
Default constructor - sets all information to "invalid" and sets fileGuid to GUID_NULL.
Definition: libCZI_ReadWrite.h:156
CCziReaderWriterInfo(const GUID &fileGuid)
Definition: libCZI_ReadWrite.h:162
Interface for the attachment repository. This interface is used to access the attachments in a CZI-fi...
Definition: libCZI.h:607
Definition: libCZI_ReadWrite.h:40
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)
virtual std::shared_ptr< IMetadataSegment > ReadMetadataSegment()=0
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 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 bool GetForceFileGuid() const =0
virtual const GUID & GetFileGuid() const =0
Interface for sub-block repository. This interface is used to access the sub-blocks in a CZI-file.
Definition: libCZI.h:532
External interfaces, classes, functions and structs are found in the namespace "libCZI".
Definition: libCZI.h:31
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:638
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