ATLAS Offline Software
Loading...
Searching...
No Matches
addLz4ToPlist.cxx File Reference
#include "LZ4Plugin/addLz4ToPlist.h"
#include "H5Cpp.h"
#include <stdexcept>
#include <array>
#include <mutex>
Include dependency graph for addLz4ToPlist.cxx:

Go to the source code of this file.

Functions

void addLz4ToPlist (H5::DSetCreatPropList &plist)

Variables

const H5Z_class2_t H5Z_LZ4 [1]

Function Documentation

◆ addLz4ToPlist()

void addLz4ToPlist ( H5::DSetCreatPropList & plist)

Definition at line 18 of file addLz4ToPlist.cxx.

18 {
19
20 // Register the filter if it isn't already known to the library.
21 // Since LZ4PluginLib is linked into the binary, H5Z_LZ4 is already
22 // in memory -- no HDF5_PLUGIN_PATH or symlink directory needed.
23 // The registry is global, so registration happens once per process.
24 static std::once_flag registered;
25 std::call_once(registered, []() {
26 if (!H5Zfilter_avail(H5Z_FILTER_LZ4)) {
27 herr_t reg = H5Zregister(H5Z_LZ4);
28 if (reg < 0) throw std::runtime_error("can't register LZ4 filter");
29 }
30 });
31
32 // this specifies additional arguments. For LZ4 this can have one
33 // entry, the chunk size. Leaving it empty should use the default
34 // chunk size.
35 std::array<unsigned int, 0> cd_values;
36
37 herr_t status = H5Pset_filter(
38 plist.getId(),
40 H5Z_FLAG_MANDATORY,
41 cd_values.size(),
42 cd_values.data());
43
44 if (status < 0) throw std::runtime_error("can't set LZ4 filter");
45
46}
#define H5Z_FILTER_LZ4
Definition H5Zlz4.h:10
const H5Z_class2_t H5Z_LZ4[1]
status
Definition merge.py:16

Variable Documentation

◆ H5Z_LZ4

const H5Z_class2_t H5Z_LZ4[1]
extern