vendredi 1 juillet 2016

Changing array shape in a compound type


I'm starting from a struct

typedef struct SpikeInfo {
        uint64 timestamp;
        int recording;
        int16 waveform[MAX_TRANSFORM_SIZE];
    } SpikeInfo;

and then I create a HDF5 compound datatype:

CompType spiketype(sizeof(SpikeInfo));
hsize_t dims[2] = {MAX_TRANSFORM_SIZE/nChannels, nChannels};
spiketype.insertMember(H5std_string("waveform"), HOFFSET(SpikeInfo, waveform), ArrayType(getNativeType(I16), 2, dims));
spiketype.insertMember(H5std_string("recording"), HOFFSET(SpikeInfo, recording), getNativeType(U16));
spiketype.insertMember(H5std_string("timestamp"), HOFFSET(SpikeInfo, timestamp), getNativeType(U64));

Thus the array has allocated MAX_TRANSFORM_SIZE/nChannels rows. However, it's most likely that I will be constantly receiving less data (for example only half of the rows), and then I end up having to fill the rest with zeros. I was wondering if there's a way to make that ArrayType resizable, so that I can make it bigger if it's necessary, but it's small at first.

I know there is a type VarLenType, but the documentation doesn't show any useful methods for it. Is such a thing possible at all?


Aucun commentaire:

Enregistrer un commentaire