-
Notifications
You must be signed in to change notification settings - Fork 12
/
bag_layerdescriptor.h
103 lines (81 loc) · 3.06 KB
/
bag_layerdescriptor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#ifndef BAG_LAYERDESCRIPTOR_H
#define BAG_LAYERDESCRIPTOR_H
#include "bag_config.h"
#include "bag_fordec.h"
#include "bag_types.h"
#include <limits>
#include <memory>
#include <string>
#include <tuple>
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4251) // std classes do not have DLL-interface when exporting
#endif
namespace BAG {
//! Describe a layer.
class BAG_API LayerDescriptor : public std::enable_shared_from_this<LayerDescriptor>
{
public:
virtual ~LayerDescriptor() = default;
LayerDescriptor(const LayerDescriptor&) = delete;
LayerDescriptor(LayerDescriptor&&) = delete;
LayerDescriptor& operator=(const LayerDescriptor&) = delete;
LayerDescriptor& operator=(LayerDescriptor&&) = delete;
bool operator==(const LayerDescriptor &rhs) const noexcept {
return m_id == rhs.m_id &&
m_layerType == rhs.m_layerType &&
m_internalPath == rhs.m_internalPath &&
m_name == rhs.m_name &&
m_compressionLevel == rhs.m_compressionLevel &&
m_chunkSize == rhs.m_chunkSize &&
m_minMax == rhs.m_minMax;
}
bool operator!=(const LayerDescriptor &rhs) const noexcept {
return !(rhs == *this);
}
uint64_t getChunkSize() const noexcept;
int getCompressionLevel() const noexcept;
DataType getDataType() const noexcept;
uint8_t getElementSize() const noexcept;
uint32_t getId() const noexcept;
const std::string& getInternalPath() const & noexcept;
LayerType getLayerType() const noexcept;
std::tuple<float, float> getMinMax() const noexcept;
const std::string& getName() const & noexcept;
LayerDescriptor& setName(std::string inName) & noexcept;
LayerDescriptor& setMinMax(float min, float max) & noexcept;
protected:
LayerDescriptor(uint32_t id, std::string internalPath, std::string name,
LayerType type, uint64_t chunkSize, int compressionLevel);
LayerDescriptor(const Dataset& dataset, LayerType type,
std::string internalPath = {}, std::string name = {});
size_t getReadBufferSize(uint32_t rows, uint32_t columns) const noexcept;
LayerDescriptor& setInternalPath(std::string inPath) & noexcept;
private:
virtual DataType getDataTypeProxy() const noexcept = 0;
virtual uint8_t getElementSizeProxy() const noexcept = 0;
//! The unique id.
uint32_t m_id = kInvalidLayerId;
//! The layer type.
LayerType m_layerType = UNKNOWN_LAYER_TYPE;
//! The path of the DataSet in the HDF5 file.
std::string m_internalPath;
//! The name of the layer.
std::string m_name;
//! The compression level of this layer (0-9).
int m_compressionLevel = 0;
//! The chunk size of this layer.
uint64_t m_chunkSize = 0;
//! The minimum and maximum value of this dataset.
std::tuple<float, float> m_minMax{};
friend GeorefMetadataLayer;
friend InterleavedLegacyLayer;
friend SurfaceCorrections;
friend SimpleLayer;
friend VRMetadata;
};
#ifdef _MSC_VER
#pragma warning(pop)
#endif
} // namespace BAG
#endif // BAG_LAYERDESCRIPTOR_H