mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
HDF5 detects if a name is a dataset or not without using exception catching
This commit is contained in:
parent
7423a352c5
commit
6b5259cc10
@ -177,23 +177,18 @@ namespace Grid
|
|||||||
|
|
||||||
// read the dimensions
|
// read the dimensions
|
||||||
H5NS::DataSpace dataSpace;
|
H5NS::DataSpace dataSpace;
|
||||||
H5E_auto2_t func;
|
|
||||||
void * client_data;
|
|
||||||
std::vector<hsize_t> hdim;
|
std::vector<hsize_t> hdim;
|
||||||
std::vector<size_t> dim;
|
std::vector<size_t> dim;
|
||||||
hsize_t size = 1;
|
hsize_t size = 1;
|
||||||
|
|
||||||
H5NS::Exception::getAutoPrint(func, &client_data);
|
if (group_.attrExists(s))
|
||||||
try
|
|
||||||
{
|
{
|
||||||
H5NS::Exception::dontPrint();
|
|
||||||
dataSpace = group_.openDataSet(s).getSpace();
|
|
||||||
}
|
|
||||||
catch (H5NS::Exception &e)
|
|
||||||
{
|
|
||||||
H5NS::Exception::setAutoPrint(func, client_data);
|
|
||||||
dataSpace = group_.openAttribute(s).getSpace();
|
dataSpace = group_.openAttribute(s).getSpace();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dataSpace = group_.openDataSet(s).getSpace();
|
||||||
|
}
|
||||||
hdim.resize(dataSpace.getSimpleExtentNdims());
|
hdim.resize(dataSpace.getSimpleExtentNdims());
|
||||||
dataSpace.getSimpleExtentDims(hdim.data());
|
dataSpace.getSimpleExtentDims(hdim.data());
|
||||||
for (auto &d: hdim)
|
for (auto &d: hdim)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user