try { // Turn off the auto-printing when failure occurs so that we can // handle the errors appropriately
Exception::dontPrint(); //创建文件 H5File file(filename, H5F_ACC_TRUNC); //创建第一层 group section Group group_Section0(file.createGroup("Section0")); group_Section0.setComment(QString::fromLocal8Bit("区域1").toStdString()); //用来作为显示的名称
Group group_Section1(file.createGroup("Section1")); group_Section1.setComment(QString::fromLocal8Bit("区域2").toStdString()); //创建第二层group run Group group_Run0(group_Section0.createGroup("Run0")); group_Run0.setComment(QString::fromLocal8Bit("测试1").toStdString()); Group group_Run1(group_Section0.createGroup("Run1")); group_Run1.setComment(QString::fromLocal8Bit("测试2").toStdString()); Group group_Run2(group_Section1.createGroup("Run0")); group_Run2.setComment(QString::fromLocal8Bit("测试3").toStdString()); Group group_Run3(group_Section1.createGroup("Run1")); group_Run3.setComment(QString::fromLocal8Bit("测试4").toStdString()); //创建第三层group timedata和spectrum Group group_Time0(group_Run0.createGroup("TimeData")); group_Time0.setComment(QString::fromLocal8Bit("实时数据").toStdString()); Group group_Spec0(group_Run0.createGroup("Spectrum")); group_Spec0.setComment(QString::fromLocal8Bit("处理数据").toStdString()); Group group_Time1(group_Run1.createGroup("TimeData")); group_Time1.setComment(QString::fromLocal8Bit("实时数据").toStdString()); Group group_Spec1(group_Run1.createGroup("Spectrum")); group_Spec1.setComment(QString::fromLocal8Bit("处理数据").toStdString()); Group group_Time2(group_Run2.createGroup("TimeData")); group_Time2.setComment(QString::fromLocal8Bit("实时数据").toStdString()); Group group_Spec2(group_Run2.createGroup("Spectrum")); group_Spec2.setComment(QString::fromLocal8Bit("处理数据").toStdString()); Group group_Time3(group_Run3.createGroup("TimeData")); group_Time3.setComment(QString::fromLocal8Bit("实时数据").toStdString()); Group group_Spec3(group_Run3.createGroup("Spectrum")); group_Spec3.setComment(QString::fromLocal8Bit("处理数据").toStdString());
#define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /*open for read and write */ #define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /*overwrite existing files */ #define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /*fail if file already exists*/ /* NOTE: 0x0008u was H5F_ACC_DEBUG, now deprecated */ #define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /*create non-existing files */ #define H5F_ACC_SWMR_WRITE (H5CHECK 0x0020u) /*indicate that this file is * open for writing in a * single-writer/multi-reader (SWMR) * scenario. Note that the * process(es) opening the file * for reading must open the file * with RDONLY access, and use * the special "SWMR_READ" access * flag. */ #define H5F_ACC_SWMR_READ (H5CHECK 0x0040u) /*indicate that this file is * open for reading in a * single-writer/multi-reader (SWMR) * scenario. Note that the * process(es) opening the file * for SWMR reading must also * open the file with the RDONLY * flag. */
/* Value passed to H5Pset_elink_acc_flags to cause flags to be taken from the * parent file. */ #define H5F_ACC_DEFAULT (H5CHECK H5OPEN 0xffffu) /*ignore setting on lapl */