SET_FILTER as optional and the can apply function returns FALSE, the library will skip the filter in the filter pipeline.
This callback can be the
NULL pointer, in which case the library will assume that the filter can be applied to a dataset with any combination of dataset creation property list values, datatypes, and dataspaces.
The can apply callback function must return a positive value for a valid combination, zero for an invalid combination, and a negative value for an error.
The set local callback function is defined as follows:
typedef herr_t (*
After the can apply callbacks are checked for a new dataset, the set local callback functions for any filters used in the dataset creation property list are called. These callbacks receive
dcpl_id, the dataset's private copy of the dataset creation property list passed in to
H5Dcreate (i.e. not the actual property list passed in to
type_id, the datatype identifier passed in to
H5Dcreate, which is not copied and should not be modified; and
space_id, a dataspace describing the chunk (for chunked dataset storage), which should also not be modified.
The set local callback must set any filter parameters that are specific to this dataset, based on the combination of the dataset creation property list values, the datatype, and the dataspace. For example, some filters perform different actions based on different datatypes, datatype sizes, numbers of dimensions, or dataspace sizes.
The set local callback may be the
NULL pointer, in which case, the library will assume that there are no dataset-specific settings for this filter.
The set local callback function must return a non-negative value on success and a negative value for an error.
The filter operation callback function, defining the filter's operation on the data, is defined as follows:
typedef size_t (*
H5Z_func_t) (unsigned int
cd_nelmts, const unsigned int
nbytes, size_t *
buf_size, void **
cd_values are the same as for the function
H5Pset_filter. The one exception is that an additional flag,
H5Z_FLAG_REVERSE, is set when the filter is called as part of the input pipeline.
*buf points to the input buffer which has a size of
nbytes of which are valid data.
The filter should perform the transformation in place if possible. If the transformation cannot be done in place, then the filter should allocate a new buffer with
malloc() and assign it to
*buf, assigning the allocated size of that buffer to
*buf_size. The old buffer should be freed by calling
If successful, the filter operation callback function returns the number of valid bytes of data contained in
*buf. In the case of failure, the return value is
0 (zero) and all pointer arguments are left unchanged.
Programming Note for C++ Developers Using C Functions:
If a C routine that takes a function pointer as an argument is called from within C++ code, the C routine should be returned from normally.
Examples of this kind of routine include callbacks such as
H5Pset_type_conv_cb and functions such as
Exiting the routine in its normal fashion allows the HDF5 C