HighFive 2.9.0
HighFive - Header-only C++ HDF5 interface
|
A collection of tips for migrating away from deprecated features.
FixedLenStringArray
.The issue with FixedLenStringArray
is that it is unable to avoid copies. Essentially, this class acts as a means to create a copy of the data in a format suitable for writing fixed-length strings. Additionally, the class acts as a tag for HighFive to overload on. The support of std::string
in HighFive has improved considerable. Since 2.8.0 we can write/read std::string
to fixed or variable length HDF5 strings.
Therefore, this class serves no purpose anymore. Any occurrence of it can be replaced with an std::vector<std::string>
(for example).
If desired one can silence warnings by replacing FixedLenStringArray
with deprecated::FixedLenStringArray
.
read(T*, ...)
.A "raw read" is when the user allocates sufficient bytes and provides HighFive with the pointer to the first byte. "Regular reads" take a detour via the inspector and might resize the container, etc.
The issue is that HighFive v2
had the following two overloads:
and the analogous for Attribute
.
The issue is that the second overload will also match things like T**
and T[][]
. For example the following code used the removed overload:
which is fine because is a contiguous sequence of doubles. It's equivalent to following v3
code:
We consider the example above to be accidentally using a raw read, when it could be performing a regular read. We suggest to not change the above, i.e.
continues to be correct in v3
and can check that the dimensions match. The inspector recognizes double[2][3]
as a contiguous array of doubles. Therefore, it'll use the shallow-copy buffer and avoid the any additional allocations or copies.
When genuinely performing a "raw read", one must replace read
with read_raw
. For example:
is correct in v3
.
In v3
we completely rewrote the CMake code of HighFive. Since HighFive is a header only library, it needs to perform two tasks:
-I ${HIGHFIVE_DIR}
and links with HDF5.We've removed all flags for optional dependencies, such as -DHIGHFIVE_USE_BOOST
. Instead user that want to read/write into/from optionally supported containers, include a header with the corresponding name and make sure to adjust their CMake code to link with the dependency.
The C++ code should have:
and the CMake code would have
There are extensive examples of project integration in tests/cmake_integration
, including how those projects in turn can be included in other projects. If these examples don't help, please feel free to open an Issue.
DataSpace::DataSpaceType
.We've converted the enum
DataSpace::DataSpaceType
to an enum class
. We've added static constexpr
members dataspace_null
and dataspace_scalar
to DataSpace
. This minimizes the risk of breaking user code.
Note that objects of type DataSpace::DataSpaceType
will no longer silently convert to an integer. Including the two constants DataSpace::dataspace_{scalar,null}
.
FileDriver
and MPIOFileDriver
.These have been deprecated to stick more closely with familiar HDF5 concepts. The FileDriver
is synonymous to FileAccessProps
; and MPIOFileDriver
is the same as:
We felt that the savings in typing effort weren't worth introducing the concept of a "file driver". Removing the concept hopefully makes it easier to add a better abstraction for the handling of the property lists, when we discover such an abstraction.