1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-10 06:00:45 +01:00

HDF5 detects if a name is a dataset or not without using exception catching

This commit is contained in:
Antonin Portelli 2017-01-20 11:03:19 -08:00
parent 7423a352c5
commit 6b5259cc10

View File

@ -177,23 +177,18 @@ namespace Grid
// read the dimensions
H5NS::DataSpace dataSpace;
H5E_auto2_t func;
void * client_data;
std::vector<hsize_t> hdim;
std::vector<size_t> dim;
hsize_t size = 1;
H5NS::Exception::getAutoPrint(func, &client_data);
try
if (group_.attrExists(s))
{
H5NS::Exception::dontPrint();
dataSpace = group_.openDataSet(s).getSpace();
}
catch (H5NS::Exception &e)
{
H5NS::Exception::setAutoPrint(func, client_data);
dataSpace = group_.openAttribute(s).getSpace();
}
else
{
dataSpace = group_.openDataSet(s).getSpace();
}
hdim.resize(dataSpace.getSimpleExtentNdims());
dataSpace.getSimpleExtentDims(hdim.data());
for (auto &d: hdim)