Coverage Report

Created: 2025-07-11 06:33

/src/bag/api/bag_vrmetadatadescriptor.h
Line
Count
Source (jump to first uncovered line)
1
#ifndef BAG_VRMETADATADESCRIPTOR_H
2
#define BAG_VRMETADATADESCRIPTOR_H
3
4
#include "bag_config.h"
5
#include "bag_fordec.h"
6
#include "bag_layerdescriptor.h"
7
8
9
namespace BAG {
10
11
//! Describe the variable resolution metadata.
12
class BAG_API VRMetadataDescriptor final : public LayerDescriptor
13
{
14
public:
15
    VRMetadataDescriptor(const VRMetadataDescriptor&) = delete;
16
    VRMetadataDescriptor(VRMetadataDescriptor&&) = delete;
17
18
    VRMetadataDescriptor& operator=(const VRMetadataDescriptor&) = delete;
19
    VRMetadataDescriptor& operator=(VRMetadataDescriptor&&) = delete;
20
21
0
    bool operator==(const VRMetadataDescriptor &rhs) const noexcept {
22
0
        return m_minDimX == rhs.m_minDimX &&
23
0
               m_minDimY == rhs.m_minDimY &&
24
0
               m_maxDimX == rhs.m_maxDimX &&
25
0
               m_maxDimY == rhs.m_maxDimY &&
26
0
               m_minResX == rhs.m_minResX &&
27
0
               m_minResY == rhs.m_minResY &&
28
0
               m_maxResX == rhs.m_maxResX &&
29
0
               m_maxResY == rhs.m_maxResY;
30
0
    }
31
32
0
    bool operator!=(const VRMetadataDescriptor &rhs) const noexcept {
33
0
        return !(rhs == *this);
34
0
    }
35
36
    std::tuple<uint32_t, uint32_t> getMaxDimensions() const noexcept;
37
    std::tuple<float, float> getMaxResolution() const noexcept;
38
    std::tuple<uint32_t, uint32_t> getMinDimensions() const noexcept;
39
    std::tuple<float, float> getMinResolution() const noexcept;
40
41
    VRMetadataDescriptor& setMaxDimensions(uint32_t maxDimX, uint32_t maxDimY) & noexcept;
42
    VRMetadataDescriptor& setMaxResolution(float maxResX, float maxResY) & noexcept;
43
    VRMetadataDescriptor& setMinDimensions(uint32_t minDimX, uint32_t minDimY) & noexcept;
44
    VRMetadataDescriptor& setMinResolution(float minResX, float minResY) & noexcept;
45
46
protected:
47
    VRMetadataDescriptor(uint32_t id, uint64_t chunkSize,
48
        int compressionLevel);
49
    explicit VRMetadataDescriptor(const Dataset& dataset);
50
51
    static std::shared_ptr<VRMetadataDescriptor> create(const Dataset& dataset,
52
        uint64_t chunkSize, int compressionLevel);
53
54
    static std::shared_ptr<VRMetadataDescriptor> open(const Dataset& dataset);
55
56
private:
57
    DataType getDataTypeProxy() const noexcept override;
58
    uint8_t getElementSizeProxy() const noexcept override;
59
60
    //! The minimum X dimension.
61
    uint32_t m_minDimX = std::numeric_limits<uint32_t>::max();
62
    //! The minimum Y dimension.
63
    uint32_t m_minDimY = std::numeric_limits<uint32_t>::max();
64
    //! The maximum X dimension.
65
    uint32_t m_maxDimX = std::numeric_limits<uint32_t>::lowest();
66
    //! The maximum Y dimension.
67
    uint32_t m_maxDimY = std::numeric_limits<uint32_t>::lowest();
68
    //! The minimum X resolution.
69
    float m_minResX = std::numeric_limits<float>::max();
70
    //! The minimum Y resolution.
71
    float m_minResY = std::numeric_limits<float>::max();
72
    //! The maximum X resolution.
73
    float m_maxResX = std::numeric_limits<float>::lowest();
74
    //! The maximum Y resolution.
75
    float m_maxResY = std::numeric_limits<float>::lowest();;
76
77
    friend Dataset;
78
    friend VRMetadata;
79
};
80
81
}  // namespace BAG
82
83
#endif  // BAG_VRMETADATADESCRIPTOR_H
84