Enea Scioni <[email protected]> wrote:
> My question is then the follow: is it possible to query, instead of
> copying of the content of the chunk of the file asked, the memory
> address (so direct access, pointing to the data) of where that data is
> stored?
> Of course, this may make sense only if some specific conditions, that
> is when the HDF5 file is not persistent, by using the driver "core"
> (all in memory), and asking for contiguous memory allocation and so
> on.
> Therefore, I would like to know if it is possible to get the pointer
> to that datatype - any content changes is reflected directly, I don't
> need to "write" anymore.
> Pointing on the same instance of s1_t with s1_t and the subset s2_t,
> any change on s2_t is reflected on the pointer over s1_t.
> (just to make it clear....once I get the address, I would like to do
> something like the follow:
>> s2[0]->c = 11;
>> printf("%d\n,s1[0]->c); --> prints '11'
> '11' is also stored in the HDF5 file
> )

You can get the offset to a dataset within the file with the function
getOffset().  You can also get the size of each record.  So you can
mmap the file and read the raw data at the right place.  We do this
for our libtinyhtm library (see lines 58-130)

  https://github.com/Caltech-IPAC/libtinyhtm/blob/master/src/tree.cxx

Cheers,
Walter

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Reply via email to