Why is there no H5LTset_attribute_unsigned_long_long?


#1

Relative newbie here - I have inherited a codebase that mainly uses the Lite functionality to write HDF5 attributes.

Now, I would like to write an unsigned long long attribute, and I was surprised to find that while (among others) H5LTset_attribute_long_long() and H5LTset_attribute_ulong() exist, there is no equivalent for attribute setter for unsigned_long_long? Is that right? What is the reason for this?

Thanks in advance!


#2

I don’t think there is a particularly deep reason. Maybe, in the dark ages, when these functions were added, there wasn’t a pre-defined native H5T_NATIVE_ULLONG type.

For a quick fix, you could just add these:

H5_HLDLL herr_t H5LTset_attribute_ullong(hid_t loc_id, const char *obj_name, const char *attr_name,
                                        const unsigned long *buffer, size_t size);

to H5LTpublic.h

herr_t
H5LTset_attribute_ullong(hid_t loc_id, const char *obj_name, const char *attr_name, const unsigned long long *data,
                        size_t size)
{

    if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_ULLONG, data) < 0)
        return -1;

    return 0;
}

to H5LT.c

This could be your first PR. Think about it! :v:

G.