You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AppFlow/FITK_Interface/FITKInterfaceIOHDF5/FITKAbstractHDF5Adaptor.h

326 lines
11 KiB
C

/**
*
* @file FITKAbstractHDF5Adaptor.h
* @brief HDF5
* @author fulipeng (flipengqd@yeah.net)
* @date 2024-05-28
*
*/
#ifndef _FITKABSTRACTHDF5ADAPTOR_H__
#define _FITKABSTRACTHDF5ADAPTOR_H__
#include "FITKInterfaceIOHDF5API.h"
#include "FITK_Kernel/FITKAdaptor/FITKAbstractIOAdaptor.h"
#include "H5Cpp.h"
namespace Core
{
class FITKAbstractNDataObject;
}
namespace IO
{
class FITKAbstractHDF5Reader;
class FITKAbstractHDF5Writer;
/**
* @brief HDF5
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-05-30
*/
class FITKINTERFACEHDF5IOAPI FITKAbstractHDF5Adaptor : public Adaptor::FITKAbstractIOAdaptor
{
FITKCLASS(IO, FITKAbstractHDF5Adaptor);
public:
explicit FITKAbstractHDF5Adaptor() = default;
virtual ~FITKAbstractHDF5Adaptor() = 0;
/**
* @brief INP
* @param reader INP
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-05-30
*/
void setFileReader(FITKAbstractHDF5Reader* reader);
/**
* @brief INP
* @param writer INP
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-05-30
*/
void setFileWriter(FITKAbstractHDF5Writer* writer);
/**
* @brief H5GroupData
* @param h5Group
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-05-28
*/
void setH5GroupData(H5::Group& h5Group);
/**
* @brief
* @return true false
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-05-29
*/
bool adaptR() override;
/**
* @brief
* @return true false
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-05-29
*/
bool adaptW() override;
/**
* @brief
* @return truefalse
* @param h5group group
* @param name
* @param str
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-06-03
*/
bool readStrAttribute(H5::Group& h5group, std::string name, std::string& str);
/**
* @brief
* @return
* @param h5group group
* @param name
* @param b
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-06-03
*/
std::string readStrAttribute(H5::H5Object& h5group, std::string name, bool* b = nullptr);
/**
* @brief
* @return truefalse
* @param h5group group
* @param name
* @param type
* @param buf
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-06-03
*/
bool readAttribute(H5::H5Object& h5group, std::string name, const H5::DataType& type, void* buf);
/**
* @brief bool
* @return bool
* @param h5group group
* @param name
* @param b
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-06-03
*/
bool readBoolAttribute(H5::H5Object& h5group, std::string name, bool* b = nullptr);
/**
* @brief
* @return
* @param h5group group
* @param name
* @param b
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-06-03
*/
double readDoubleAttribute(H5::H5Object& h5group, std::string name, bool* b = nullptr);
/**
* @brief
* @return
* @param h5group group
* @param name
* @param b
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-06-13
*/
bool readDoubleDataSet(H5::Group& h5group, std::string name, QList<double>& buff, int n = 1, int m = 1, bool* b = nullptr);
/**
* @brief
* @return
* @param h5group group
* @param name
* @param b
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-06-13
*/
bool readDoubleAttrbuteDataSet(H5::Group& h5group, std::string name, QList<double>& buff, int n = 1, int m = 1, bool* b = nullptr);
/**
* @brief
* @return
* @param h5group group
* @param name
* @param b
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-06-03
*/
bool readIntVectorAttribute(H5::Group& h5group, std::string name, void* buff);
/**
* @brief
* @return
* @param h5group group
* @param name
* @param b
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-06-03
*/
int readIntAttribute(H5::H5Object& h5group, std::string name, bool* b = nullptr);
/**
* @brief
* @return truefalse
* @param h5group group
* @param name
* @param n
* @param m
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-06-03
*/
bool getAttributeDim(H5::Group& h5group, std::string name, int& n, int& m);
/**
* @brief
* @return truefalse
* @param h5group group
* @param name
* @param n
* @param m
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-06-03
*/
bool getDataSetDim(H5::Group& h5group, std::string name, int& n, int& m);
/**
* @brief
* @param h5group group
* @param name
* @param rtStrs
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-06-03
*/
void readStrDataSet(H5::Group& h5group, std::string name, std::vector< std::string >& rtStrs);
/**
* @brief
* @param h5group group
* @param name
* @param rtStrs
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-06-03
*/
void readStrDataSet(H5::Group& h5group, std::string name, QList<QString>& rtStrs);
/**
* @brief int
* @param h5group group
* @param name
* @param data
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-06-03
*/
void readIntDataSet(H5::H5Object& h5group, std::string name, QList< int >& data);
/**
* @brief h5group
* @param h5groupgroupnametypebufnm2
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-05-29
*/
void writeAttribute(H5::H5Object& h5group, std::string name, const H5::DataType& type, const void* buf, int n = 1, int m = 1);
void writeStrAttribute(H5::H5Object& h5group, std::string name, std::string data);
void writeBoolAttribute(H5::H5Object& h5group, std::string name, const void* buf, int n = 1, int m = 1);
void writeDoubleAttribute(H5::H5Object& h5group, std::string name, const void* buf, int n = 1, int m = 1);
void writeDoubleAttributeDataset(H5::H5Object& h5group, std::string name, QList<double>& buf, int n = 1, int m = 1);
void writeIntAttribute(H5::H5Object& h5group, std::string name, const void* buf, int n = 1, int m = 1);
void writeStrDataSet(H5::H5Object& h5group, std::string name, std::vector< std::string > data);
void writeStrDataSet(H5::H5Object& h5group, std::string name, const QList< QString >& data);
void writeIntDataSet(H5::H5Object& h5group, std::string name, const QList< int >& data);
void writeDoubleDataSet(H5::H5Object& h5group, std::string name, const QList< double >& data);
protected:
#ifdef QT_DEBUG
std::string createParentAttribute(Core::FITKAbstractNDataObject* obj, H5::H5Object & h5Object);
#endif
std::string createParentAttribute(Core::FITKAbstractDataObject* obj, H5::H5Object & h5Object);
/**
* @brief NDataObject
* @param obj:
* @return
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-06-04
*/
bool readNDataObject(Core::FITKAbstractNDataObject* obj, H5::H5Object & h5Object);
/**
* @brief NDataObject
* @param obj:
* @return
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-06-04
*/
bool readDataObject(Core::FITKAbstractDataObject* obj, H5::H5Object & h5Object);
/**
* @brief NDataObject
* @param obj:
* @return
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-05-31
*/
bool writeNDataObject(Core::FITKAbstractNDataObject* obj, H5::H5Object & h5Object);
/**
* @brief NDataObject
* @param obj:
* @return
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-05-31
*/
bool writeDataObject(Core::FITKAbstractDataObject* obj, H5::H5Object & h5Object);
protected:
/**
* @brief INP
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-05-30
*/
FITKAbstractHDF5Reader* _reader{};
/**
* @brief INP
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-05-30
*/
FITKAbstractHDF5Writer* _writer{};
/**
* @brief H5Group
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-05-30
*/
H5::Group* _h5Group{};
/**
* @brief _h5GroupGroup
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-05-30
*/
H5::Group _h5CreateGroup;
};
}
#endif