Coverage Report

Created: 2026-05-24 07:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/lerc/src/LercLib/Lerc1Decode/Image.h
Line
Count
Source
1
/*
2
Copyright 2015 - 2026 Esri
3
4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7
8
http://www.apache.org/licenses/LICENSE-2.0
9
10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
16
A local copy of the license and additional notices are located with the
17
source distribution at:
18
19
http://github.com/Esri/lerc/
20
21
Contributors:  Thomas Maurer
22
*/
23
24
#ifndef IMAGE_H
25
#define IMAGE_H
26
27
#include <string>
28
#include "../Defines.h"
29
30
NAMESPACE_LERC_START
31
32
class Image
33
{
34
public:
35
36
0
  virtual ~Image()  {};
37
38
  enum Type { BYTE, RGB, SHORT, LONG, FLOAT, DOUBLE, COMPLEX, POINT3F, CNT_Z, CNT_ZXY, Last_Type_ };
39
40
0
  bool isType(Type t) const  { return t == type_; }
41
0
  Type getType() const       { return type_; }
42
0
  int getWidth() const       { return width_; }
43
0
  int getHeight() const      { return height_; }
44
0
  int getSize() const        { return width_ * height_; }
45
46
0
  bool isInside(int row, int col) const  { return row >= 0 && row < height_ && col >= 0 && col < width_; }
47
48
  virtual std::string getTypeString() const = 0;
49
50
protected:
51
52
0
  Image() : type_(Last_Type_), width_(0), height_(0)  {};
53
54
  /// compare
55
0
  bool operator == (const Image& img) const  { return type_ == img.type_ && width_ == img.width_ && height_ == img.height_; }
56
0
  bool operator != (const Image& img) const  { return !operator==(img); };
57
58
  Type type_;
59
  int width_, height_;
60
};
61
62
NAMESPACE_LERC_END
63
#endif