/src/bag/api/bag_vrrefinementsdescriptor.cpp
Line | Count | Source |
1 | | |
2 | | #include "bag_exceptions.h" |
3 | | #include "bag_private.h" |
4 | | #include "bag_vrrefinementsdescriptor.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 | | VRRefinementsDescriptor::VRRefinementsDescriptor( |
19 | | uint32_t id, |
20 | | uint32_t rows, uint32_t cols, |
21 | | uint64_t chunkSize, |
22 | | int compressionLevel) |
23 | 0 | : LayerDescriptor(id, VR_REFINEMENT_PATH, |
24 | 0 | kLayerTypeMapString.at(VarRes_Refinement), VarRes_Refinement, |
25 | 0 | rows, cols, |
26 | 0 | chunkSize, compressionLevel) |
27 | 0 | { |
28 | 0 | } |
29 | | |
30 | | //! Constructor. |
31 | | /*! |
32 | | \param dataset |
33 | | The BAG Dataset this layer belongs to. |
34 | | */ |
35 | | VRRefinementsDescriptor::VRRefinementsDescriptor( |
36 | | const Dataset& dataset, uint32_t rows, uint32_t cols) |
37 | 0 | : LayerDescriptor(dataset, VarRes_Refinement, rows, cols, VR_REFINEMENT_PATH) |
38 | 0 | { |
39 | 0 | } |
40 | | |
41 | | //! Create a new variable resolution refinements descriptor. |
42 | | /*! |
43 | | \param dataset |
44 | | The BAG Dataset this layer belongs to. |
45 | | \param chunkSize |
46 | | The chunk size the HDF5 DataSet will use. |
47 | | \param compressionLevel |
48 | | The compression level the HDF5 DataSet will use. |
49 | | |
50 | | \return |
51 | | The new variable resolution refinements descriptor. |
52 | | */ |
53 | | std::shared_ptr<VRRefinementsDescriptor> VRRefinementsDescriptor::create( |
54 | | const Dataset& dataset, |
55 | | uint64_t chunkSize, |
56 | | int compressionLevel) |
57 | 0 | { |
58 | 0 | return std::shared_ptr<VRRefinementsDescriptor>( |
59 | 0 | new VRRefinementsDescriptor{dataset.getNextId(), 0, 0, chunkSize, |
60 | 0 | compressionLevel}); |
61 | 0 | } |
62 | | |
63 | | //! Open an existing variable resolution refinements descriptor. |
64 | | /*! |
65 | | \param dataset |
66 | | The BAG Dataset this layer belongs to. |
67 | | |
68 | | \return |
69 | | The existing variable resolution refinements descriptor. |
70 | | */ |
71 | | std::shared_ptr<VRRefinementsDescriptor> VRRefinementsDescriptor::open( |
72 | | const Dataset& dataset, uint32_t rows, uint32_t cols) |
73 | 0 | { |
74 | 0 | return std::shared_ptr<VRRefinementsDescriptor>( |
75 | 0 | new VRRefinementsDescriptor{dataset, rows, cols}); |
76 | 0 | } |
77 | | |
78 | | |
79 | | //! \copydoc LayerDescriptor::getDataType |
80 | | DataType VRRefinementsDescriptor::getDataTypeProxy() const noexcept |
81 | 0 | { |
82 | 0 | return DT_COMPOUND; |
83 | 0 | } |
84 | | |
85 | | //! \copydoc LayerDescriptor::getElementSize |
86 | | uint8_t VRRefinementsDescriptor::getElementSizeProxy() const noexcept |
87 | 0 | { |
88 | 0 | return sizeof(BagVRRefinementsItem); |
89 | 0 | } |
90 | | |
91 | | //! Retrieve the minimum and maximum depth. |
92 | | /*! |
93 | | \return |
94 | | The minimum and maximum depth. |
95 | | */ |
96 | | std::tuple<float, float> |
97 | | VRRefinementsDescriptor::getMinMaxDepth() const noexcept |
98 | 0 | { |
99 | 0 | return {m_minDepth, m_maxDepth}; |
100 | 0 | } |
101 | | |
102 | | //! Retrieve the minimum and maximum uncertainty. |
103 | | /*! |
104 | | \return |
105 | | The minimum and maximum uncertainty. |
106 | | */ |
107 | | std::tuple<float, float> |
108 | | VRRefinementsDescriptor::getMinMaxUncertainty() const noexcept |
109 | 0 | { |
110 | 0 | return {m_minUncertainty, m_maxUncertainty}; |
111 | 0 | } |
112 | | |
113 | | //! Set the minimum and maximum depth. |
114 | | /*! |
115 | | \param minDepth |
116 | | The new minimum depth. |
117 | | \param maxDepth |
118 | | The new maximum depth. |
119 | | |
120 | | \return |
121 | | The variable resolution refinements layer descriptor. |
122 | | */ |
123 | | VRRefinementsDescriptor& VRRefinementsDescriptor::setMinMaxDepth( |
124 | | float minDepth, |
125 | | float maxDepth) & noexcept |
126 | 0 | { |
127 | 0 | m_minDepth = minDepth; |
128 | 0 | m_maxDepth = maxDepth; |
129 | 0 | return *this; |
130 | 0 | } |
131 | | |
132 | | //! Set the minimum and maximum uncertainty. |
133 | | /*! |
134 | | \param minUncertainty |
135 | | The new minimum uncertainty. |
136 | | \param maxUncertainty |
137 | | The new maximum uncertainty. |
138 | | |
139 | | \return |
140 | | The variable resolution refinements layer descriptor. |
141 | | */ |
142 | | VRRefinementsDescriptor& VRRefinementsDescriptor::setMinMaxUncertainty( |
143 | | float minUncertainty, |
144 | | float maxUncertainty) & noexcept |
145 | 0 | { |
146 | 0 | m_minUncertainty = minUncertainty; |
147 | 0 | m_maxUncertainty = maxUncertainty; |
148 | 0 | return *this; |
149 | 0 | } |
150 | | |
151 | | } // namespace BAG |
152 | | |