Coverage Report

Created: 2025-07-11 06:33

/src/bag/api/bag_vrmetadata.h
Line
Count
Source (jump to first uncovered line)
1
#ifndef BAG_VRMETADATA_H
2
#define BAG_VRMETADATA_H
3
4
#include "bag_config.h"
5
#include "bag_deleteh5dataset.h"
6
#include "bag_fordec.h"
7
#include "bag_layer.h"
8
9
#include <memory>
10
11
12
namespace BAG {
13
14
#ifdef _MSC_VER
15
#pragma warning(push)
16
#pragma warning(disable: 4251)  // std classes do not have DLL-interface when exporting
17
#endif
18
19
//! The interface for variable resolution metadata.
20
class BAG_API VRMetadata final : public Layer
21
{
22
public:
23
    VRMetadata(Dataset& dataset,
24
               VRMetadataDescriptor& descriptor,
25
               std::unique_ptr<::H5::DataSet, DeleteH5dataSet> pH5dataSet);
26
27
    VRMetadata(const VRMetadata&) = delete;
28
    VRMetadata(VRMetadata&&) = delete;
29
30
    VRMetadata& operator=(const VRMetadata&) = delete;
31
    VRMetadata& operator=(VRMetadata&&) = delete;
32
33
0
    bool operator==(const VRMetadata &rhs) const noexcept {
34
0
        return m_pH5dataSet == rhs.m_pH5dataSet;
35
0
    }
36
37
0
    bool operator!=(const VRMetadata &rhs) const noexcept {
38
0
        return !(rhs == *this);
39
0
    }
40
41
    std::shared_ptr<VRMetadataDescriptor> getDescriptor() & noexcept;
42
    std::shared_ptr<const VRMetadataDescriptor> getDescriptor() const & noexcept;
43
44
protected:
45
    static std::shared_ptr<VRMetadata> create(Dataset& dataset,
46
        uint64_t chunkSize, int compressionLevel);
47
48
    static std::shared_ptr<VRMetadata> open(Dataset& dataset,
49
        VRMetadataDescriptor& descriptor);
50
51
private:
52
    static std::unique_ptr<::H5::DataSet, DeleteH5dataSet>
53
        createH5dataSet(const Dataset& dataset,
54
            const VRMetadataDescriptor& descriptor);
55
56
    UInt8Array readProxy(uint32_t rowStart,
57
        uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd) const override;
58
59
    void writeProxy(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd,
60
        uint32_t columnEnd, const uint8_t *buffer) override;
61
62
    void writeAttributesProxy() const override;
63
64
    //! The HDF5 DataSet the metadata wraps.
65
    std::unique_ptr<::H5::DataSet, DeleteH5dataSet> m_pH5dataSet;
66
67
    friend Dataset;
68
};
69
70
#ifdef _MSC_VER
71
#pragma warning(pop)
72
#endif
73
74
}  // namespace BAG
75
76
#endif  // BAG_VRMETADATA_H
77