#include "Hdf5Resource.h"#include <hdf5.h>#include <vector>Go to the source code of this file.
Classes | |
| class | Hdf5CustomReader |
| This interface should be implemented to allow a custom type to be read by the HdfPlugInLib. More... | |
Functions | |
| template<typename T> | |
| Hdf5CustomReader * | createHdf5CustomReader (hid_t dataType) |
| Hdf5CustomReader* createHdf5CustomReader | ( | hid_t | dataType | ) |
This function should be specialized for any custom types that need to be read using the Hdf5Data::readData() function which is provided for both Hdf5Dataset and Hdf5Attribute.
An example is shown below:
struct mySampleType { int foo; int bar; }; class mySampleTypeReader; //assume this is declared elsewhere as class mySampleTypeReader : public Hdf5CustomReader //Want to read mySampleType using Hdf5Data::readData function template<> Hdf5CustomReader* createHdf5CustomReader<mySampleType>(hid_t dataType) { return new mySampleTypeReader(dataType); } //now to read the data, assume pData is a pointer of type Hdf5Data, ie. Hdf5Dataset or Hdf5Attribute mySampleType* pSampleData = pData->readData<mySampleType>(); //the read call above will use your createHdf5CustomReader specialization and your subclass //of Hdf5CustomReader to perform the read from the Hdf5 file and conversion to mySampleType.
| dataType | This is the HDF5 datatype of the data that will be read. |