/src/bag/api/bag_vrmetadatadescriptor.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | |
2 | | #include "bag_exceptions.h" |
3 | | #include "bag_private.h" |
4 | | #include "bag_vrmetadatadescriptor.h" |
5 | | |
6 | | |
7 | | namespace BAG { |
8 | | |
9 | | //! Constructor. |
10 | | /*! |
11 | | \param id |
12 | | The unique layer id. |
13 | | \param chunkSize |
14 | | The chunk size the HDF5 DataSet will use. |
15 | | \param compressionLevel |
16 | | The compression level the HDF5 DataSet will use. |
17 | | */ |
18 | | VRMetadataDescriptor::VRMetadataDescriptor( |
19 | | uint32_t id, |
20 | | uint64_t chunkSize, |
21 | | int compressionLevel) |
22 | 0 | : LayerDescriptor(id, VR_METADATA_PATH, |
23 | 0 | kLayerTypeMapString.at(VarRes_Metadata), VarRes_Metadata, chunkSize, |
24 | 0 | compressionLevel) |
25 | 0 | { |
26 | 0 | } |
27 | | |
28 | | //! Constructor. |
29 | | /*! |
30 | | \param dataset |
31 | | The BAG Dataset this layer belongs to. |
32 | | */ |
33 | | VRMetadataDescriptor::VRMetadataDescriptor( |
34 | | const Dataset& dataset) |
35 | 0 | : LayerDescriptor(dataset, VarRes_Metadata, VR_METADATA_PATH) |
36 | 0 | { |
37 | 0 | } |
38 | | |
39 | | //! Create a variable resolution metadata descriptor. |
40 | | /*! |
41 | | \param dataset |
42 | | The BAG Dataset this layer belongs to. |
43 | | \param chunkSize |
44 | | The chunk size the HDF5 DataSet will use. |
45 | | \param compressionLevel |
46 | | The compression level the HDF5 DataSet will use. |
47 | | |
48 | | \return |
49 | | The new variable resolution metadata descriptor. |
50 | | */ |
51 | | std::shared_ptr<VRMetadataDescriptor> VRMetadataDescriptor::create( |
52 | | const Dataset& dataset, |
53 | | uint64_t chunkSize, |
54 | | int compressionLevel) |
55 | 0 | { |
56 | 0 | return std::shared_ptr<VRMetadataDescriptor>( |
57 | 0 | new VRMetadataDescriptor{dataset.getNextId(), chunkSize, |
58 | 0 | compressionLevel}); |
59 | 0 | } |
60 | | |
61 | | //! Open an existing variable resolution metadata descriptor. |
62 | | /*! |
63 | | \param dataset |
64 | | The BAG Dataset this layer belongs to. |
65 | | |
66 | | \return |
67 | | The variable resolution metadata descriptor. |
68 | | */ |
69 | | std::shared_ptr<VRMetadataDescriptor> VRMetadataDescriptor::open( |
70 | | const Dataset& dataset) |
71 | 0 | { |
72 | 0 | return std::shared_ptr<VRMetadataDescriptor>( |
73 | 0 | new VRMetadataDescriptor{dataset}); |
74 | 0 | } |
75 | | |
76 | | |
77 | | //! \copydoc LayerDescriptor::getDataType |
78 | | DataType VRMetadataDescriptor::getDataTypeProxy() const noexcept |
79 | 0 | { |
80 | 0 | return DT_COMPOUND; |
81 | 0 | } |
82 | | |
83 | | //! \copydoc LayerDescriptor::getElementSize |
84 | | uint8_t VRMetadataDescriptor::getElementSizeProxy() const noexcept |
85 | 0 | { |
86 | 0 | return sizeof(VRMetadataItem); |
87 | 0 | } |
88 | | |
89 | | //! Retrieve the maximum dimensions. |
90 | | /*! |
91 | | \return |
92 | | The maximum X and Y dimensions. |
93 | | */ |
94 | | std::tuple<uint32_t, uint32_t> |
95 | | VRMetadataDescriptor::getMaxDimensions() const noexcept |
96 | 0 | { |
97 | 0 | return {m_maxDimX, m_maxDimY}; |
98 | 0 | } |
99 | | |
100 | | //! Retrieve the maximum resolution. |
101 | | /*! |
102 | | \return |
103 | | The maximum X and Y resolution. |
104 | | */ |
105 | | std::tuple<float, float> |
106 | | VRMetadataDescriptor::getMaxResolution() const noexcept |
107 | 0 | { |
108 | 0 | return {m_maxResX, m_maxResY}; |
109 | 0 | } |
110 | | |
111 | | //! Retrieve the minimum dimensions. |
112 | | /*! |
113 | | \return |
114 | | The minimum X and Y dimensions. |
115 | | */ |
116 | | std::tuple<uint32_t, uint32_t> |
117 | | VRMetadataDescriptor::getMinDimensions() const noexcept |
118 | 0 | { |
119 | 0 | return {m_minDimX, m_minDimY}; |
120 | 0 | } |
121 | | |
122 | | //! Retrieve the minimum resolution. |
123 | | /*! |
124 | | \return |
125 | | The minimum X and Y resolution. |
126 | | */ |
127 | | std::tuple<float, float> |
128 | | VRMetadataDescriptor::getMinResolution() const noexcept |
129 | 0 | { |
130 | 0 | return {m_minResX, m_minResY}; |
131 | 0 | } |
132 | | |
133 | | //! Set the maximum dimensions. |
134 | | /*! |
135 | | \param maxDimX |
136 | | The maximum X dimension. |
137 | | \param maxDimY |
138 | | The maximum Y dimension. |
139 | | |
140 | | \return |
141 | | The variable resolution metadata descriptor. |
142 | | */ |
143 | | VRMetadataDescriptor& VRMetadataDescriptor::setMaxDimensions( |
144 | | uint32_t maxDimX, |
145 | | uint32_t maxDimY) & noexcept |
146 | 0 | { |
147 | 0 | m_maxDimX = maxDimX; |
148 | 0 | m_maxDimY = maxDimY; |
149 | 0 | return *this; |
150 | 0 | } |
151 | | |
152 | | //! Set the maximum resolution. |
153 | | /*! |
154 | | \param maxResX |
155 | | The maximum X resolution. |
156 | | \param maxResY |
157 | | The maximum Y resolution. |
158 | | |
159 | | \return |
160 | | The variable resolution metadata descriptor. |
161 | | */ |
162 | | VRMetadataDescriptor& VRMetadataDescriptor::setMaxResolution( |
163 | | float maxResX, |
164 | | float maxResY) & noexcept |
165 | 0 | { |
166 | 0 | m_maxResX = maxResX; |
167 | 0 | m_maxResY = maxResY; |
168 | 0 | return *this; |
169 | 0 | } |
170 | | |
171 | | //! Set the minimum dimensions. |
172 | | /*! |
173 | | \param minDimX |
174 | | The minimum X dimension. |
175 | | \param minDimY |
176 | | The minimum Y dimension. |
177 | | |
178 | | \return |
179 | | The variable resolution metadata descriptor. |
180 | | */ |
181 | | VRMetadataDescriptor& VRMetadataDescriptor::setMinDimensions( |
182 | | uint32_t minDimX, |
183 | | uint32_t minDimY) & noexcept |
184 | 0 | { |
185 | 0 | m_minDimX = minDimX; |
186 | 0 | m_minDimY = minDimY; |
187 | 0 | return *this; |
188 | 0 | } |
189 | | |
190 | | //! Set the minimum resolution. |
191 | | /*! |
192 | | \param minResX |
193 | | The minimum X resolution. |
194 | | \param minResY |
195 | | The minimum Y resolution. |
196 | | |
197 | | \return |
198 | | The variable resolution metadata descriptor. |
199 | | */ |
200 | | VRMetadataDescriptor& VRMetadataDescriptor::setMinResolution( |
201 | | float minResX, |
202 | | float minResY) & noexcept |
203 | 0 | { |
204 | 0 | m_minResX = minResX; |
205 | 0 | m_minResY = minResY; |
206 | 0 | return *this; |
207 | 0 | } |
208 | | |
209 | | } // namespace BAG |
210 | | |