libCZI
Reading CZI documents made easy
libCZI_Site.h
1 //******************************************************************************
2 //
3 // libCZI is a reader for the CZI fileformat written in C++
4 // Copyright (C) 2017 Zeiss Microscopy GmbH
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 //
19 // To obtain a commercial version please contact Zeiss Microscopy GmbH.
20 //
21 //******************************************************************************
22 
23 #pragma once
24 
25 #include <sstream>
26 
27 namespace libCZI
28 {
31  enum class ImageDecoderType
32  {
34  };
35 
36  class IBitmapData;
37 
39  class IDecoder
40  {
41  public:
42 
55  virtual std::shared_ptr<libCZI::IBitmapData> Decode(const void* ptrData, size_t size) = 0;
56  };
57 
59  const int LOGLEVEL_ERROR = 1;
60  const int LOGLEVEL_SEVEREWARNING = 2;
61  const int LOGLEVEL_WARNING = 3;
62  const int LOGLEVEL_INFORMATION = 4;
64 
67  class ISite
68  {
69  public:
79  virtual bool IsEnabled(int logLevel) = 0;
80 
87  virtual void Log(int level, const char* szMsg) = 0;
88 
95  virtual std::shared_ptr<IDecoder> GetDecoder(ImageDecoderType type, const char* arguments) = 0;
96 
109  virtual std::shared_ptr<libCZI::IBitmapData> CreateBitmap(libCZI::PixelType pixeltype, std::uint32_t width, std::uint32_t height, std::uint32_t stride = 0, std::uint32_t extraRows = 0, std::uint32_t extraColumns = 0) = 0;
110 
114  void Log(int level, const std::string& str)
115  {
116  this->Log(level, str.c_str());
117  }
118 
122  void Log(int level, std::stringstream& ss)
123  {
124  this->Log(level, ss.str());
125  }
126 
127 
128  };
129 }
PixelType
An enum representing a pixel-type.
Definition: libCZI_Pixels.h:126
virtual bool IsEnabled(int logLevel)=0
const int LOGLEVEL_ERROR
Identifies a non-recoverable error.
Definition: libCZI_Site.h:59
const int LOGLEVEL_CHATTYINFORMATION
Identifies an informational output which has no impact on proper operation. Use this for output which...
Definition: libCZI_Site.h:63
virtual void Log(int level, const char *szMsg)=0
const int LOGLEVEL_INFORMATION
Identifies an informational output. It has no impact on the proper operation.
Definition: libCZI_Site.h:62
void Log(int level, const std::string &str)
Definition: libCZI_Site.h:114
Definition: libCZI_Site.h:67
virtual std::shared_ptr< libCZI::IBitmapData > Decode(const void *ptrData, size_t size)=0
virtual std::shared_ptr< IDecoder > GetDecoder(ImageDecoderType type, const char *arguments)=0
External interfaces, classes, functions and structs are found in the namespace "libCZI".
Definition: libCZI.h:44
virtual std::shared_ptr< libCZI::IBitmapData > CreateBitmap(libCZI::PixelType pixeltype, std::uint32_t width, std::uint32_t height, std::uint32_t stride=0, std::uint32_t extraRows=0, std::uint32_t extraColumns=0)=0
const int LOGLEVEL_WARNING
Identifies that a problem has been identified. It is likely that proper operation can be kept up...
Definition: libCZI_Site.h:61
void Log(int level, std::stringstream &ss)
Definition: libCZI_Site.h:122
const int LOGLEVEL_CATASTROPHICERROR
Identifies a catastrophic error (i. e. the program cannot continue).
Definition: libCZI_Site.h:58
The interface used for operating image decoder. That is the simplest possible interface at this point...
Definition: libCZI_Site.h:39
const int LOGLEVEL_SEVEREWARNING
Identifies that a severe problem has occured. Proper operation of the module is not ensured...
Definition: libCZI_Site.h:60
Identifies an encoder capable of decoding a JPG-XR compressed image.
ImageDecoderType
Definition: libCZI_Site.h:31