Hi,

Here's my problem:
I have to read a dataset (HDF5 Compund DataSet)
ex:
label    size    needComputation      dataArray
1         200            0            {222, 222.5, 223, 223.5,...}
3         100            1            {710, 712, 724, 756,...}
8         2            1                {3.753, 0}
to this structure:

typedef struct 
{
    unsigned int label;
    unsigned long long size;
    bool needComputation;
    double* dataArray;
} my_data_type;

I can read label, size, needComputation but not dataArray which is a 
Variable-length of 64-bit floating-point.

For bool type I use:

EnumType boolEnumType(sizeof(bool));
bool falseValue = 0;
bool trueValue = 1;
boolEnumType.insert("FALSE", &falseValue);
boolEnumType.insert("TRUE", &trueValue);
    
// compound type
CompType mtype( sizeof(my_data_type) );

mtype.insertMember( "Label",    HOFFSET(my_data_type, label), 
PredType::NATIVE_UINT);
mtype.insertMember( "size",    HOFFSET(my_data_type, size), 
PredType::NATIVE_UINT64);
mtype.insertMember( "NeedComputation",    HOFFSET(my_data_type, isEven), 
boolEnumType);
//mtype.insertMember( "DataArray",    HOFFSET(my_data_type, dataArray), 
PredType::H5T_IEEE_F64LE); 
// This last line give me: CompType::insertMember   H5Tinsert failed

DataSpace ds = dataset.getSpace();

hssize_t n = sid1.getSimpleExtentNpoints();
my_data_type* mdt = new my_data_type[n];
dataset.read( mdt, mtype);

for( int i = 0; i < n; i++)
{
    cout <<"label " << mdt[i].label << " size "<< mdt[i].size << " 
needComputation "<< mdt[i].needComputation << endl;
}

delete[] mdt;

-----------------

So, how can I read "dataArray" of double and know the size of this array ?
I haven't find any example about this in c++.

Thank you for your help.
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

Reply via email to