Suppose an application wants to call different functions based on the version of the HDF5 library to which an application will be linked. For example, the link functions, H5Lxxx , are new in the 1.8 versions of HDF5, and some group functions, H5Gxxx , are deprecated in the 1.8 versions. The following code uses H5Gunlink if the library version is 1.6.10 or earlier or uses H5Ldelete if the library version is not 1.6.10 or earlier. Similarly, the code calls H5Gopen or H5Lexists to make sure the group has been deleted. #if H5_VERSION_LE(1,6,10)
ret = H5Gunlink(file, "Group");
CHECK(ret, FAIL, "H5Gunlink");
H5E_BEGIN_TRY {
grp = H5Gopen(file, "Group");
} H5E_END_TRY;
VERIFY(grp, FAIL, "H5Gopen");
#else
ret = H5Ldelete(file, "Group", H5P_DEFAULT);
CHECK(ret, FAIL, "H5Lunlink");
status = H5Lexists(file, "Group", H5P_DEFAULT);
VERIFY(status, FALSE, "H5Lexists");
#endif Comment |
---|
HTML Wrap |
---|
| Bitbucket Server file |
---|
repoSlug | hdf5 |
---|
branchId | refs/heads/1.10/master |
---|
projectKey | HDFFV |
---|
filepath | examples/h5_subset.c |
---|
showLineNumbers | true |
---|
lineStart | 32 |
---|
progLang | cpp |
---|
lineEnd | 42 |
---|
applicationLink | 5ac7b370-7412-3c8c-ad20-807a68261336 |
---|
|
|
|
|