Apollo3zehn / PureHDF

A pure .NET library that makes reading and writing of HDF5 files (groups, datasets, attributes, ...) very easy.
MIT License
47 stars 16 forks source link

Enumeration to return a dictionary of enumerates #121

Closed rtran89 closed 1 week ago

rtran89 commented 1 week ago

Hi @Apollo3zehn , Regarding https://github.com/Apollo3zehn/PureHDF/issues/119#issuecomment-2190959846. I was thinking like this, where it returns a Dictionary that has the enumerations stored within the _dataType. I might be mistakenly using the Enumeration interface, but what do you think?

Apollo3zehn commented 1 week ago

Thanks for your PR. Now I understand what you actually want :-) It should be implemented a little bit different and will work on it today evening so it is ready to release today or tomorrow. I will also work on finishing the bitshuffle filter implementation and when both is done there will be a new release.

Apollo3zehn commented 1 week ago

I had to change the implementation a bit to make it more general. Here is a screenshot which shows how to use the new method GetMembers:

image

Sorry for all the red lines. I forgot my main computer at work and have now a quite broken Visual Studio Code installation.

Since enumerations can only have integer data as base type, you only need to check the size of the datatype (and maybe the sign using the dataset.Type.Enumeration.BaseType.FixedPoint.IsSigned property) and then use an appropriate C# integer type as type argument to the GetMembers<T>() function. I hope this will help you getting more info about the HDF5 enumeration type.