Bounds checking of read and write operations

Hello all,

I have a question about how one would implement bounds checking prior to calling H5Dread and H5Dwrite on a buffer.

Assuming you know the size of the buffer you pass to these functions, how can one determine how many bytes will be read/written prior to performing the operation?

Obviously, this will depend on the details of the data type and dataspaces passed to H5Dread/H5Dwrite.

H5Tget_size will probably factor into the equation.

H5Sget_select_npoints will probably also need to be taken into account.

H5Soffset_simple might also have to be taken into account.

H5Sget_select_bounds might also have an effect.

Has anybody written a function that could be used in the general case? Maybe it's something that could be added to the HDF API in the future. In the mean time, I'd appreciate any thoughts on all the corner cases that need to be covered to make sure the bounds check is accurate.

Thanks for reading.

Regards,

Albert

···

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

One of the stakeholders for our product is spending a considerable
amount of time trying to break down their web of structured data in to
primitive data arrays to store the data. Their program is written in
Fortran.

Also, in the future, many other applications will have to do the same
thing. So we are interested if some other users of HDF5 have had
similar problems.

Specifically, is there some library for Fortran that can take 1) a
series of nested Fortran type definitions and 2) a pointer to one of the
structures and use that information to create a set of arrays with the
data from those structures.

Or is there some application written which can take the structure
definitions and produce Fortran code for each of the structures that
will do the same?

David McCloskey
Engineer
Software Products

Westinghouse Electric Company
Energy Center, East 479G
Monroeville, PA, 15146, USA
Phone: +1 (412) 374-3789
Email: mcclosdl@westinghouse.com
Home Page: www.westinghousenuclear.com

···

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

Hi Albert,

Hello all,

I have a question about how one would implement bounds checking prior to calling H5Dread and H5Dwrite on a buffer.

Assuming you know the size of the buffer you pass to these functions, how can one determine how many bytes will be read/written prior to performing the operation?

Obviously, this will depend on the details of the data type and dataspaces passed to H5Dread/H5Dwrite.

H5Tget_size will probably factor into the equation.

H5Sget_select_npoints will probably also need to be taken into account.

H5Soffset_simple might also have to be taken into account.

H5Sget_select_bounds might also have an effect.

Has anybody written a function that could be used in the general case? Maybe it's something that could be added to the HDF API in the future. In the mean time, I'd appreciate any thoughts on all the corner cases that need to be covered to make sure the bounds check is accurate.

  I think all those routines will be involved, along with H5Sget_select_hyper_nblocks/H5Sget_select_hyper_blocklist and H5Sget_select_elem_npoints/H5Sget_select_elem_pointlist possibly. If you only want to know the # of bytes, you only need H5Sget_select_npoints & H5Tget_size. However, if you want to know _which_ bytes are involved, you are going to have to use the H5Sget_select_bounds and the blocklist/pointlist routines, probably. You might use H5Diterate instead, but I think that'll be slower. Of course, variable-length sequences and strings complicate the matter by having pointers to other locations in memory.

  Quincey

···

On Feb 15, 2008, at 2:56 PM, Albert Strasheim wrote:

Thanks for reading.

Regards,

Albert

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

Hi David,

One of the stakeholders for our product is spending a considerable
amount of time trying to break down their web of structured data in to
primitive data arrays to store the data. Their program is written in
Fortran.

Also, in the future, many other applications will have to do the same
thing. So we are interested if some other users of HDF5 have had
similar problems.

Specifically, is there some library for Fortran that can take 1) a
series of nested Fortran type definitions and 2) a pointer to one of the
structures and use that information to create a set of arrays with the
data from those structures.

Or is there some application written which can take the structure
definitions and produce Fortran code for each of the structures that
will do the same?

  I'm not aware of anything like this for Fortran, but there's similar "high level" routines in the new 1.8.0 release: H5LTtext_to_dtype/H5LTdtype_to_text, although they are for C.

  Quincey

···

On Feb 18, 2008, at 11:46 AM, McCloskey, David L. wrote:

David McCloskey
Engineer
Software Products

Westinghouse Electric Company
Energy Center, East 479G
Monroeville, PA, 15146, USA
Phone: +1 (412) 374-3789
Email: mcclosdl@westinghouse.com
Home Page: www.westinghousenuclear.com

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.