[hdf-forum] Referenced dataset problems (C++)

Tarjei Knapstad tknapstad at emgs.com
Mon Mar 30 11:45:07 EDT 2009


Hi,

I'm having a bit of a struggle working with references through the C++ 
API. What I want to do is basically create two datasets "s1" and "s2" 
and then create a reference to "s2" from "s1". When I open the file 
later on I want to check if "s1" has a reference to another dataset, and 
if so open that dataset. Here's a reduced example:

#include "H5Cpp.h"
using namespace H5;
int main()
{
   {
     H5File file("test.h5", H5F_ACC_TRUNC);
     hsize_t dim = 1;
     DataSpace space(1, &dim);
     DataSet set1 = file.createDataSet("s1", PredType::NATIVE_INT, space);
     DataSet set2 = file.createDataSet("s2", PredType::NATIVE_INT, space);
     hdset_reg_ref_t ref;
     set1.reference(&ref, "/s2");
   }
   {
     H5File file("test.h5", H5F_ACC_RDONLY);
     DataSet set1 = file.openDataSet("s1");
     // At this point, how do I check if "s1" has references
     // to other datasets?
     // And how do I get "set2" through the reference created
     // in the first block of code?
   }
}

Hope someone can help me out with this!

Regards,
-- 
Tarjei Knapstad
Software Engineer, R&D

EMGS
Stiklestadveien 1
7041 TRONDHEIM
Norway

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





More information about the Hdf-forum mailing list