/src/bag/api/bag_vrnodedescriptor.cpp
Line | Count | Source |
1 | | |
2 | | #include "bag_exceptions.h" |
3 | | #include "bag_private.h" |
4 | | #include "bag_vrnodedescriptor.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 | | VRNodeDescriptor::VRNodeDescriptor( |
19 | | uint32_t id, |
20 | | uint32_t rows, uint32_t cols, |
21 | | uint64_t chunkSize, |
22 | | int compressionLevel) |
23 | 0 | : LayerDescriptor(id, VR_NODE_PATH, |
24 | 0 | kLayerTypeMapString.at(VarRes_Node), VarRes_Node, |
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 | | VRNodeDescriptor::VRNodeDescriptor( |
36 | | const Dataset& dataset, |
37 | | uint32_t rows, uint32_t cols) |
38 | 0 | : LayerDescriptor(dataset, VarRes_Node, rows, cols, VR_NODE_PATH) |
39 | 0 | { |
40 | 0 | } |
41 | | |
42 | | //! Create a mew variable resolution node. |
43 | | /*! |
44 | | \param dataset |
45 | | The BAG Dataset this layer belongs to. |
46 | | \param chunkSize |
47 | | The chunk size the HDF5 DataSet will use. |
48 | | \param compressionLevel |
49 | | The compression level the HDF5 DataSet will use. |
50 | | |
51 | | \return |
52 | | A new variable resolution node layer. |
53 | | |
54 | | */ |
55 | | std::shared_ptr<VRNodeDescriptor> VRNodeDescriptor::create( |
56 | | const Dataset& dataset, |
57 | | uint64_t chunkSize, |
58 | | int compressionLevel) |
59 | 0 | { |
60 | 0 | return std::shared_ptr<VRNodeDescriptor>( |
61 | 0 | new VRNodeDescriptor{dataset.getNextId(), 0, 0, chunkSize, |
62 | 0 | compressionLevel}); |
63 | 0 | } |
64 | | |
65 | | //! Open an existing variable resolution node. |
66 | | /*! |
67 | | \param dataset |
68 | | The BAG Dataset this layer belongs to. |
69 | | */ |
70 | | std::shared_ptr<VRNodeDescriptor> VRNodeDescriptor::open( |
71 | | const Dataset& dataset, uint32_t rows, uint32_t cols) |
72 | 0 | { |
73 | 0 | return std::shared_ptr<VRNodeDescriptor>( |
74 | 0 | new VRNodeDescriptor{dataset, rows, cols}); |
75 | 0 | } |
76 | | |
77 | | //! \copydoc LayerDescriptor::getDataType |
78 | | DataType VRNodeDescriptor::getDataTypeProxy() const noexcept |
79 | 0 | { |
80 | 0 | return DT_COMPOUND; |
81 | 0 | } |
82 | | |
83 | | //! \copydoc LayerDescriptor::getElementSize |
84 | | uint8_t VRNodeDescriptor::getElementSizeProxy() const noexcept |
85 | 0 | { |
86 | 0 | return sizeof(BagVRNodeItem); |
87 | 0 | } |
88 | | |
89 | | //! Retrieve the minimum and maximum hypotheses strength. |
90 | | /*! |
91 | | \return |
92 | | The minimum and maximum hypotheses strength. |
93 | | */ |
94 | | std::tuple<float, float> |
95 | | VRNodeDescriptor::getMinMaxHypStrength() const noexcept |
96 | 0 | { |
97 | 0 | return {m_minHypStrength, m_maxHypStrength}; |
98 | 0 | } |
99 | | |
100 | | //! Retrieve the minimum and maximum n samples. |
101 | | /*! |
102 | | \return |
103 | | The minimum and maximum n samples. |
104 | | */ |
105 | | std::tuple<uint32_t, uint32_t> |
106 | | VRNodeDescriptor::getMinMaxNSamples() const noexcept |
107 | 0 | { |
108 | 0 | return {m_minNSamples, m_maxNSamples}; |
109 | 0 | } |
110 | | |
111 | | //! Retrieve the minimum and maximum number of hypotheses. |
112 | | /*! |
113 | | \return |
114 | | The minimum and maximum number of hypotheses. |
115 | | */ |
116 | | std::tuple<uint32_t, uint32_t> |
117 | | VRNodeDescriptor::getMinMaxNumHypotheses() const noexcept |
118 | 0 | { |
119 | 0 | return {m_minNumHypotheses, m_maxNumHypotheses}; |
120 | 0 | } |
121 | | |
122 | | //! Set the minimum and maximum hypotheses strength. |
123 | | /*! |
124 | | \param minHypStrength |
125 | | The minimum hypotheses strength. |
126 | | \param maxHypStrength |
127 | | The maximum hypotheses strength. |
128 | | |
129 | | \return |
130 | | The variable resolution node descriptor. |
131 | | */ |
132 | | VRNodeDescriptor& VRNodeDescriptor::setMinMaxHypStrength( |
133 | | float minHypStrength, |
134 | | float maxHypStrength) & noexcept |
135 | 0 | { |
136 | 0 | m_minHypStrength = minHypStrength; |
137 | 0 | m_maxHypStrength = maxHypStrength; |
138 | 0 | return *this; |
139 | 0 | } |
140 | | |
141 | | //! Set the minimum and maximum number of samples. |
142 | | /*! |
143 | | \param minNSamples |
144 | | The minimum number of samples. |
145 | | \param maxNSamples |
146 | | The maximum number of samples. |
147 | | |
148 | | \return |
149 | | The variable resolution node descriptor. |
150 | | */ |
151 | | VRNodeDescriptor& VRNodeDescriptor::setMinMaxNSamples( |
152 | | uint32_t minNSamples, |
153 | | uint32_t maxNSamples) & noexcept |
154 | 0 | { |
155 | 0 | m_minNSamples = minNSamples; |
156 | 0 | m_maxNSamples = maxNSamples; |
157 | 0 | return *this; |
158 | 0 | } |
159 | | |
160 | | //! Set the minimum and maximum number of hypotheses. |
161 | | /*! |
162 | | \param minNumHypotheses |
163 | | The minimum number of hypotheses. |
164 | | \param maxNumHypotheses |
165 | | The maximum number of hypotheses. |
166 | | |
167 | | \return |
168 | | The variable resolution node descriptor. |
169 | | */ |
170 | | VRNodeDescriptor& VRNodeDescriptor::setMinMaxNumHypotheses( |
171 | | uint32_t minNumHypotheses, |
172 | | uint32_t maxNumHypotheses) & noexcept |
173 | 0 | { |
174 | 0 | m_minNumHypotheses = minNumHypotheses; |
175 | 0 | m_maxNumHypotheses = maxNumHypotheses; |
176 | 0 | return *this; |
177 | 0 | } |
178 | | |
179 | | } // namespace BAG |
180 | | |