Namespace hdf5::filter

Classes

Filter

class Filter

abstract filter class

Base class for all filters. These classes are primarily intended to allow easy configuration of filters. They basically only store the fitlers parameters and apply them to the dataset creation property list.

Subclassed by hdf5::filter::Deflate, hdf5::filter::ExternalFilter, hdf5::filter::Fletcher32, hdf5::filter::NBit, hdf5::filter::SZip, hdf5::filter::ScaleOffset, hdf5::filter::Shuffle

Public Functions

Filter()

default constructor

Required for compliance with STL containers. Can use the default implementation.

virtual void operator()(const property::DatasetCreationList &dcpl, Availability flag = Availability::Mandatory) const = 0

apply filter

Applies a filter to a particular dataset creation property list.

Throws

std::runtime_error – in case of a failure

Parameters
  • dcpl – reference to the dataset creation property list

  • flag – determines the availability requirement for a filter which is mandatory by default.

FilterID id() const noexcept

get the ID of the filter

Return the actual ID of a filter. As we do not store any particular HDF5 state in this class this function does not throw and is a constexpr.

virtual bool is_encoding_enabled() const

get the the config flag if encoding enabled

Return the actual config encoding enabled flag of the filter.

virtual bool is_decoding_enabled() const

get the the config flag if decoding enabled

Return the actual config decoding enabled flag of the filter.

ExternalFilter

class ExternalFilter : public hdf5::filter::Filter

Public Functions

ExternalFilter(FilterID id, const std::vector<unsigned int> cd_values, const std::string &name = std::string())

construtor

This constructor of External Filter.

Parameters
  • id – the ID of the filter

  • cd_values – is a vector with compression options.

  • name – external filter name

virtual void operator()(const property::DatasetCreationList &dcpl, Availability flag = Availability::Mandatory) const override

apply filter

Applies a filter to a particular dataset creation property list.

Throws

std::runtime_error – in case of a failure

Parameters
  • dcpl – reference to the dataset creation property list

  • flag – determines the availability requirement for a filter which is mandatory by default.

const std::vector<unsigned int> cd_values() const noexcept

compression options

Provides compression options of the external filter

Returns

compression options

const std::string name() const noexcept

compression options

Provides the external filter name

Returns

filter name

ExternalFilters

class ExternalFilters : public std::vector<ExternalFilter>

utility container for external filters

This is a one to one derived type from std::vector in order to provide a convenient container for external filters. The interface is exactly the same as for std::vector.

Public Functions

const std::vector<Availability> fill(const property::DatasetCreationList &dcpl, size_t max_cd_number = 16, size_t max_name_size = 257)

apply filter

Fills a filter list with filters from a particular dataset creation property list.

Throws

std::runtime_error – in case of a failure

Parameters
  • dcpl – reference to the dataset creation property list

  • max_cd_number – maximal numer of cd_values

  • max_name_size – maximal fileter name size

Returns

filter flags

Functions

is_filter_available()

bool hdf5::filter::is_filter_available(FilterID id)

is filter available

Checks if external filter is installed

Parameters

id – the ID of the filter

Returns

status flag if the filter available

Enumerations

Availability

enum class hdf5::filter::Availability : unsigned int

availability requirement of a filter

When a filter is applied to a dataset creation property list the user in general must declare a degree of availability for the filter. A filter can be either optional or mandatory. In the former case the filter is simply omitted if not available (for instance an external filter) in the latter case the operation fails if the filter is not available.

This enumeration type is used to mark a filter as optional or mandatory.

Values:

enumerator Mandatory
enumerator Optional

Filter classes

Deflate

class Deflate : public hdf5::filter::Filter

Public Functions

Deflate()

default constructor

Deflate(unsigned int value)

constructor with level value

unsigned int level() const noexcept

get the level value

void level(unsigned int value)

set the level value

virtual void operator()(const property::DatasetCreationList &dcpl, Availability flag = Availability::Mandatory) const override

apply filter

Applies a filter to a particular dataset creation property list.

Throws

std::runtime_error – in case of a failure

Parameters
  • dcpl – reference to the dataset creation property list

  • flag – determines the availability requirement for a filter which is mandatory by default.

Shuffle

class Shuffle : public hdf5::filter::Filter

Public Functions

Shuffle()

default constructor

virtual void operator()(const property::DatasetCreationList &dcpl, Availability flag = Availability::Mandatory) const override

apply filter

Applies a filter to a particular dataset creation property list.

Throws

std::runtime_error – in case of a failure

Parameters
  • dcpl – reference to the dataset creation property list

  • flag – determines the availability requirement for a filter which is mandatory by default.

Fletcher32

class Fletcher32 : public hdf5::filter::Filter

Fletcher32 checksum filter.

If applied to a dataset creation property list this filter will setup the fletcher32 checksum filter.

Public Functions

Fletcher32()

default constructor

virtual void operator()(const property::DatasetCreationList &dcpl, Availability flag = Availability::Mandatory) const override

apply filter

Applies the filter to a dataset creation property list.

Throws

std::runtime_error – in case of a failure

Parameters
  • dcpl – reference to the dataset creation property list

  • flag – availability flag

SZip

class SZip : public hdf5::filter::Filter

Public Types

enum class OptionMask : unsigned int

encoding method

Values:

enumerator None

without coding

enumerator AllowK13

allow K13 coding method

enumerator Chip

chip coding method

enumerator EntropyCoding

entropy coding method

enumerator NearestNeighbor

nearest neighbor coding method

using OptionMaskBase = std::underlying_type<OptionMask>::type

option mask base type

Public Functions

SZip()

default constructor

SZip(OptionMask option_mask, unsigned int pixels_per_block)

constructor option mask and pixels per block

SZip(OptionMaskBase option_mask, unsigned int pixels_per_block)

constructor option mask and pixels per block

OptionMaskBase option_mask() const noexcept

get the option mask

void option_mask(OptionMaskBase option_mask)

set the option mask

void option_mask(OptionMask option_mask)

set the option mask

unsigned int pixels_per_block() const noexcept

get pixels per block

void pixels_per_block(unsigned int pixels_per_block)

set pixels per block

virtual void operator()(const property::DatasetCreationList &dcpl, Availability flag = Availability::Mandatory) const override

apply filter

Applies a filter to a particular dataset creation property list.

Throws

std::runtime_error – in case of a failure

Parameters
  • dcpl – reference to the dataset creation property list

  • flag – determines the availability requirement for a filter which is mandatory by default.

SZip::OptionMaskBase hdf5::filter::operator|(const SZip::OptionMask &lhs, const SZip::OptionMask &rhs)
SZip::OptionMaskBase hdf5::filter::operator|(const SZip::OptionMaskBase &lhs, const SZip::OptionMask &rhs)
SZip::OptionMaskBase hdf5::filter::operator|(const SZip::OptionMask &lhs, const SZip::OptionMaskBase &rhs)
SZip::OptionMaskBase hdf5::filter::operator&(const SZip::OptionMask &lhs, const SZip::OptionMask &rhs)
SZip::OptionMaskBase hdf5::filter::operator&(const SZip::OptionMaskBase &lhs, const SZip::OptionMask &rhs)
SZip::OptionMaskBase hdf5::filter::operator&(const SZip::OptionMask &lhs, const SZip::OptionMaskBase &rhs)
bool hdf5::filter::operator==(const SZip::OptionMask &lhs, const SZip::OptionMask &rhs)
bool hdf5::filter::operator==(const SZip::OptionMaskBase &lhs, const SZip::OptionMask &rhs)
bool hdf5::filter::operator==(const SZip::OptionMask &lhs, const SZip::OptionMaskBase &rhs)
bool hdf5::filter::operator!=(const SZip::OptionMask &lhs, const SZip::OptionMask &rhs)
bool hdf5::filter::operator!=(const SZip::OptionMaskBase &lhs, const SZip::OptionMask &rhs)
bool hdf5::filter::operator!=(const SZip::OptionMask &lhs, const SZip::OptionMaskBase &rhs)
std::ostream &hdf5::filter::operator<<(std::ostream &stream, const SZip::OptionMask &flags)

NBit

class NBit : public hdf5::filter::Filter

NBit checksum filter.

If applied to a dataset creation property list this filter will setup the nbit checksum filter.

Public Functions

NBit()

default constructor

virtual void operator()(const property::DatasetCreationList &dcpl, Availability flag = Availability::Mandatory) const override

apply filter

Applies the filter to a dataset creation property list.

Throws

std::runtime_error – in case of a failure

Parameters
  • dcpl – reference to the dataset creation property list

  • flag – availability flag

ScaleOffset

class ScaleOffset : public hdf5::filter::Filter

Public Types

enum class ScaleType : std::underlying_type<H5Z_SO_scale_type_t>::type

character set encoding used by string types and links

Values:

enumerator FloatDScale

floating-point type, using variable MinBits method

enumerator FloatEScale

floating-point type, using fixed MinBits method

enumerator Int

integer type

Public Functions

ScaleOffset()

default constructor

ScaleOffset(ScaleOffset::ScaleType scale_type, int scale_factor)

constructor with scale type and scale factor

ScaleOffset::ScaleType scale_type() const noexcept

get scale type

void scale_type(ScaleOffset::ScaleType scale_type)

set scale type

int scale_factor() const noexcept

get scale factor

void scale_factor(int scale_factor)

set scale factor

virtual void operator()(const property::DatasetCreationList &dcpl, Availability flag = Availability::Mandatory) const override

apply filter

Applies a filter to a particular dataset creation property list.

Throws

std::runtime_error – in case of a failure

Parameters
  • dcpl – reference to the dataset creation property list

  • flag – determines the availability requirement for a filter which is mandatory by default.

std::ostream &hdf5::filter::operator<<(std::ostream &stream, const ScaleOffset::ScaleType &scale_type)

stream output operator for CharacterEncoding enumerations

Parameters
  • stream – reference to an output stream

  • scale_type – reference to the scala type to write

Returns

modified output stream