File indexing completed on 2024-12-22 03:35:45
0001 /* 0002 File : HDF5FilterPrivate.h 0003 Project : LabPlot 0004 Description : Private implementation class for HDF5Filter. 0005 -------------------------------------------------------------------- 0006 SPDX-FileCopyrightText: 2015-2018 Stefan Gerlach <stefan.gerlach@uni.kn> 0007 0008 SPDX-License-Identifier: GPL-2.0-or-later 0009 */ 0010 #ifndef HDF5FILTERPRIVATE_H 0011 #define HDF5FILTERPRIVATE_H 0012 0013 #include <QList> 0014 #ifdef HAVE_HDF5 0015 #include <hdf5.h> 0016 #endif 0017 0018 class AbstractDataSource; 0019 0020 class HDF5FilterPrivate { 0021 public: 0022 explicit HDF5FilterPrivate(HDF5Filter*); 0023 0024 #ifdef HAVE_HDF5 0025 static void handleError(int err, const QString& function, const QString& arg = QString()); 0026 #endif 0027 0028 int parse(const QString& fileName, QTreeWidgetItem* rootItem); 0029 void readDataFromFile(const QString& fileName, AbstractDataSource* = nullptr, AbstractFileFilter::ImportMode = AbstractFileFilter::ImportMode::Replace); 0030 QVector<QStringList> readCurrentDataSet(const QString& fileName, 0031 AbstractDataSource*, 0032 bool& ok, 0033 AbstractFileFilter::ImportMode = AbstractFileFilter::ImportMode::Replace, 0034 int lines = -1); 0035 void write(const QString& fileName, AbstractDataSource*); 0036 0037 const HDF5Filter* q; 0038 0039 QString currentDataSetName; 0040 int startRow{1}; 0041 int endRow{-1}; 0042 int startColumn{1}; 0043 int endColumn{-1}; 0044 0045 private: 0046 #ifdef HAVE_HDF5 0047 int m_status; 0048 #endif 0049 const static int MAXNAMELENGTH = 1024; 0050 const static int MAXSTRINGLENGTH = 1024 * 1024; 0051 QList<unsigned long> m_multiLinkList; // used to find hard links 0052 0053 #ifdef HAVE_HDF5 0054 QString translateHDF5Order(H5T_order_t); 0055 QString translateHDF5Type(hid_t); 0056 QString translateHDF5Class(H5T_class_t); 0057 AbstractColumn::ColumnMode translateHDF5TypeToMode(hid_t); 0058 QStringList readHDF5Compound(hid_t tid); 0059 template<typename T> 0060 QStringList readHDF5Data1D(hid_t dataset, hid_t type, int rows, int lines, void* dataPointer = nullptr); 0061 QStringList readHDF5CompoundData1D(hid_t dataset, hid_t tid, int rows, int lines, std::vector<void*>& dataPointer); 0062 template<typename T> 0063 QVector<QStringList> readHDF5Data2D(hid_t dataset, hid_t ctype, int rows, int cols, int lines, std::vector<void*>& dataPointer); 0064 QVector<QStringList> readHDF5CompoundData2D(hid_t dataset, hid_t tid, int rows, int cols, int lines); 0065 QStringList readHDF5Attr(hid_t aid); 0066 QStringList scanHDF5Attrs(hid_t oid); 0067 QStringList readHDF5DataType(hid_t tid); 0068 QStringList readHDF5PropertyList(hid_t pid); 0069 void scanHDF5DataType(hid_t tid, char* dataTypeName, QTreeWidgetItem* parentItem); 0070 void scanHDF5Link(hid_t gid, char* linkName, QTreeWidgetItem* parentItem); 0071 void scanHDF5DataSet(hid_t dsid, char* dataSetName, QTreeWidgetItem* parentItem); 0072 void scanHDF5Group(hid_t gid, char* groupName, QTreeWidgetItem* parentItem); 0073 #endif 0074 }; 0075 0076 #endif