You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

148 lines
5.9 KiB

#ifndef H5MACROS_H
#define H5MACROS_H
#define WRITE_INTERNAL_VECTOR_DATASET(input, paramsName, listName, nameStr, dataType) \
do \
{ \
auto listName ## _data = input.paramsName.listName.data(); \
hsize_t dims[1]{static_cast<hsize_t>(input.paramsName.listName.count())}; \
H5::DataSpace* dataspace = new H5::DataSpace(1, dims); \
H5::DataSet* dataset = \
new H5::DataSet(_file.createDataSet(nameStr, \
H5::PredType::dataType, *dataspace, H5P_DEFAULT, \
H5P_DEFAULT, H5P_DEFAULT)); \
dataset->write(listName ## _data, \
H5::PredType::dataType, \
H5P_DEFAULT, \
H5P_DEFAULT, \
H5P_DEFAULT); \
delete dataspace; \
delete dataset; \
} \
while(0) \
//halfPeriodVector.append(input.hwRegister.pulseProps.at(i).halfPeriod)
#define WRITE_INTERNAL_QTZD_VECTOR_DS(input, \
paramsName, \
listName, \
qName, \
nameStr, \
dataType) \
do \
{ \
auto tempMember = input.paramsName.listName.at(0).qName; \
QVector<typeof (tempMember)> list; \
for(int i = 0; i < input.paramsName.listName.count(); ++i) \
{ \
list.append(input.paramsName.listName.at(i).qName); \
} \
auto listName ## _data = list.data(); \
hsize_t dims[1]{static_cast<hsize_t>(list.count())}; \
H5::DataSpace* dataspace = new H5::DataSpace(1, dims); \
H5::DataSet* dataset = \
new H5::DataSet(_file.createDataSet(nameStr, \
H5::PredType::dataType, *dataspace, H5P_DEFAULT, \
H5P_DEFAULT, H5P_DEFAULT)); \
dataset->write(listName ## _data, \
H5::PredType::dataType, \
H5P_DEFAULT, \
H5P_DEFAULT, \
H5P_DEFAULT); \
delete dataspace; \
delete dataset; \
} \
while(0) \
#define WRITE_INTERNAL_2D_VECTOR_DATASET(input, paramsName, listName, nameStr, dataType) \
do \
{ \
auto tempMember = input.paramsName.listName.at(0).at(0); \
QVector<typeof (tempMember)> list; \
for(int i = 0; i < input.paramsName.listName.count(); ++i){ \
for(int j = 0; j < input.paramsName.listName.at(i).count(); ++j){ \
list.append(input.paramsName.listName.at(i).at(j)); \
} \
} \
auto listName ## _data = list.data(); \
hsize_t dims[1]{static_cast<hsize_t>(list.count())}; \
H5::DataSpace* dataspace = new H5::DataSpace(1, dims); \
H5::DataSet* dataset = \
new H5::DataSet(_file.createDataSet(nameStr, \
H5::PredType::dataType, *dataspace, H5P_DEFAULT, \
H5P_DEFAULT, H5P_DEFAULT)); \
dataset->write(listName ## _data, \
H5::PredType::dataType, \
H5P_DEFAULT, \
H5P_DEFAULT, \
H5P_DEFAULT); \
delete dataspace; \
delete dataset; \
} \
while(0) \
#define WRITE_VECTOR_DATASET(input, listName, nameStr, dataType) \
do \
{ \
auto listName ## _data = input.listName.data(); \
hsize_t dims[1]{static_cast<hsize_t>(input.listName.count())}; \
H5::DataSpace* dataspace = new H5::DataSpace(1, dims); \
H5::DataSet* dataset = \
new H5::DataSet(_file.createDataSet(nameStr, \
H5::PredType::dataType, *dataspace, H5P_DEFAULT, \
H5P_DEFAULT, H5P_DEFAULT)); \
dataset->write(listName ## _data, \
H5::PredType::dataType, \
H5P_DEFAULT, \
H5P_DEFAULT, \
H5P_DEFAULT); \
delete dataspace; \
delete dataset; \
} \
while(0) \
#define WRITE_Single_DATASET(input, valueName, nameStr, dataType) \
do \
{ \
auto valueName ## _data = &input.valueName; \
hsize_t dims[1]{static_cast<hsize_t>(1)}; \
H5::DataSpace* dataspace = new H5::DataSpace(1, dims); \
H5::DataSet* dataset = \
new H5::DataSet(_file.createDataSet(nameStr, \
H5::PredType::dataType, *dataspace, H5P_DEFAULT, \
H5P_DEFAULT, H5P_DEFAULT)); \
dataset->write(valueName ## _data, \
H5::PredType::dataType, \
H5P_DEFAULT, \
H5P_DEFAULT, \
H5P_DEFAULT); \
delete dataspace; \
delete dataset; \
} \
while(0) \
#define WRITE_INTERNAL_SINGLE_DATASET(input, paramsName, valueName, nameStr, dataType) \
do \
{ \
auto valueName ## _data = &input.paramsName.valueName; \
hsize_t dims[1]{static_cast<hsize_t>(1)}; \
H5::DataSpace* dataspace = new H5::DataSpace(1, dims); \
H5::DataSet* dataset = \
new H5::DataSet(_file.createDataSet(nameStr, \
H5::PredType::dataType, *dataspace, H5P_DEFAULT, \
H5P_DEFAULT, H5P_DEFAULT)); \
dataset->write(valueName ## _data, \
H5::PredType::dataType, \
H5P_DEFAULT, \
H5P_DEFAULT, \
H5P_DEFAULT); \
delete dataspace; \
delete dataset; \
} \
while(0) \
#endif //H5MACROS_H