mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	HDF5 detects if a name is a dataset or not without using exception catching
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user