C++ Read Compound dataset without taking static structure for different fieldname

I have multiple H5 files and i am creating a generic code where i need to read specific field defined in input whether it will be an array or double or int. i can’t take like fixed struct s1_t like below because it has defined for specific h5 file.

typedef struct s1_t {
int a;
float b;
double c;
float arr[ARRSIZE];
} s1_t;

let say one file having data like this as per below :

image

another file having the data like this as below:

image

I am using Visual studio 19 in windows with C++17 standard and HDF5 1.12.2 C++ wrapper.

any help will be appreciated.

Thank you in advance