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