YODA::H5FileManager Class Reference Helper class to extract AO information from a H5 file. More...
Detailed DescriptionConstructor & Destructor Documentation◆ H5FileManager()
Constructor. Definition at line 279 of file H5Utils.h. 280 : _index(-1), _cachepos(-1),
281 _labelindex(0), _h5file(file),
282 _aoinfo(file, "aoinfo"),
283 _layout(file, "sizeinfo"),
284 _content(file, "content"),
285 _annos(file, "annotations"),
286 _labels(H5DataSetReader(file, "labels").read<string>()) {
287
288 _meta = _aoinfo.readAttribute("meta");
289 if (_meta.size() < 2)
290 throw ReadError("No file metadata found!");
291
292 _annosizes = _layout.read<size_t>(_meta.at(1));
293 _datasizes = _layout.read<size_t>(_meta.at(1));
294 _labelsizes = _layout.read<size_t>(_layout.next());
295 }
Member Function Documentation◆ loadAnnotations()
Serialized annotations of current AO. Definition at line 333 of file H5Utils.h. 333 {
334 return _annos.readSlice<string>(_annosizes[_index]);
335 }
Referenced by YODA::AOReader< Counter >::mkFromH5(), YODA::AOReader< Estimate0D >::mkFromH5(), YODA::AOReader< ScatterND< N > >::mkFromH5(), YODA::AOReader< BinnedDbn< DbnN, AxisT... > >::mkFromH5(), and YODA::AOReader< BinnedEstimate< AxisT... > >::mkFromH5(). ◆ loadContent()
Serialized content of current AO. Definition at line 338 of file H5Utils.h. 338 {
339 return _content.readSlice<double>(_datasizes[_index]);
340 }
Referenced by YODA::AOReader< Counter >::mkFromH5(), YODA::AOReader< Estimate0D >::mkFromH5(), YODA::AOReader< ScatterND< N > >::mkFromH5(), YODA::AOReader< BinnedDbn< DbnN, AxisT... > >::mkFromH5(), and YODA::AOReader< BinnedEstimate< AxisT... > >::mkFromH5(). ◆ loadEdges()
template<typename EdgeT >
Returns next set of edges of type EdgeT. Definition at line 385 of file H5Utils.h. 385 {
386
388 auto itr = datasets.find(label);
389 if (itr == datasets.end()) {
390 // put H5::DataSet into DataSet cache
391 datasets[label] = H5DataSetReader(_h5file, label);
392 itr = datasets.find(label);
393 }
394 return itr->second.read<EdgeT>(_layout.next());
395 }
References YODA::TypeID< T >::name(). ◆ loadMasks()
Indices of masked bins in current AO. Definition at line 349 of file H5Utils.h. 349 {
350 return _layout.read<size_t>(_layout.next());
351 }
Referenced by YODA::AOReader< BinnedDbn< DbnN, AxisT... > >::mkFromH5(), and YODA::AOReader< BinnedEstimate< AxisT... > >::mkFromH5(). ◆ loadSources()
Labels of error sources of current AO. Definition at line 359 of file H5Utils.h. 359 {
360
361 if (_cachepos < 0) { // fill label cache
362 _labelcache = _layout.read<size_t>(_labelsizes[_labelindex++]);
363 _cachepos = 0;
364 }
365
366 size_t len = _labelcache[_cachepos++];
367 if (len == 0) return {};
368
369 vector<size_t> indices(_labelcache.begin()+_cachepos, _labelcache.begin()+_cachepos+len);
370 vector<string> sources; sources.reserve(indices.size());
371 for (size_t idx : indices) {
372 sources.emplace_back(_labels[idx]);
373 }
374 _cachepos += len;
375 return sources;
376 }
Referenced by YODA::AOReader< Estimate0D >::mkFromH5(), and YODA::AOReader< BinnedEstimate< AxisT... > >::mkFromH5(). ◆ next()
Loads next AO from file. Definition at line 308 of file H5Utils.h. 308 {
309 ++_index;
311
313 if (_aodims.empty()) {
314 throw ReadError("No AO information found!");
315 }
316
317 _cachepos = -1;
318
319 return true;
320 }
References AO_META, and size(). Referenced by YODA::ReaderH5::read(). ◆ path()
Path of current AO. Definition at line 323 of file H5Utils.h. 323 {
324 return _aodims.at(0);
325 }
Referenced by YODA::AOReader< Counter >::mkFromH5(), YODA::AOReader< Estimate0D >::mkFromH5(), YODA::AOReader< ScatterND< N > >::mkFromH5(), YODA::AOReader< BinnedDbn< DbnN, AxisT... > >::mkFromH5(), YODA::AOReader< BinnedEstimate< AxisT... > >::mkFromH5(), and YODA::ReaderH5::read(). ◆ size()
◆ skipCommon()
Skips next set of annotations and content of current AO. Definition at line 343 of file H5Utils.h. 343 {
344 _annos.skip(_annosizes[_index]);
345 _content.skip(_datasizes[_index]);
346 }
Referenced by YODA::AOReaderBase::skip(), YODA::AOReader< Estimate0D >::skip(), YODA::AOReader< BinnedDbn< DbnN, AxisT... > >::skip(), and YODA::AOReader< BinnedEstimate< AxisT... > >::skip(). ◆ skipEdges()
template<typename EdgeT >
Skips next set of edges of type EdgeT. Definition at line 399 of file H5Utils.h. 399 {
401 auto itr = datasets.find(label);
402 if (itr == datasets.end()) {
403 // put H5::DataSet into DataSet cache
404 datasets[label] = H5DataSetReader(_h5file, label);
405 itr = datasets.find(label);
406 }
407 itr->second.skip(_layout.next());
408 }
References YODA::TypeID< T >::name(). ◆ skipMasks()
Skips next set of masked indices of current AO. Definition at line 354 of file H5Utils.h. 354 {
355 _layout.skip(_layout.next());
356 }
Referenced by YODA::AOReader< BinnedDbn< DbnN, AxisT... > >::skip(), and YODA::AOReader< BinnedEstimate< AxisT... > >::skip(). ◆ skipSources()
Skips next set of error sources of current AO. Definition at line 379 of file H5Utils.h. 379 {
380 _layout.skip(_labelsizes[_labelindex++]);
381 }
Referenced by YODA::AOReader< Estimate0D >::skip(), and YODA::AOReader< BinnedEstimate< AxisT... > >::skip(). ◆ type()
Type of current AO. Definition at line 328 of file H5Utils.h. 328 {
329 return _aodims.at(1);
330 }
Referenced by YODA::ReaderH5::read(). ◆ version()
Member Data Documentation◆ AO_META
Definition at line 276 of file H5Utils.h. Referenced by next(), and YODA::WriterH5::writeAOS(). The documentation for this class was generated from the following file:
Generated on Fri Mar 7 2025 09:06:40 for YODA - Yet more Objects for Data Analysis by |