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/FITKInterfaceGeoIOHDF5/FITKAbstractHDF5Adaptor.h

379 lines
13 KiB
C

/**
*
* @file FITKAbstractHDF5Adaptor.h
* @brief HDF5
* @author fulipeng (flipengqd@yeah.net)
* @date 2024-09-09
*
*/
#ifndef _FITKABSTRACTHDF5ADAPTOR_H__
#define _FITKABSTRACTHDF5ADAPTOR_H__
#include "FITKInterfaceGeoIOHDF5API.h"
#include "FITK_Kernel/FITKCore/FITKCoreMacros.h"
#include "FITK_Kernel/FITKAdaptor/FITKAbstractIOAdaptor.h"
#include "H5Cpp.h"
namespace Core
{
class FITKAbstractNDataObject;
}
ForwardDeclarNS(Interface, FITKAbsGeoCommand);
namespace IO
{
class FITKAbstractHDF5Reader;
class FITKAbstractHDF5Writer;
/**
* @brief HDF5
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-09-09
*/
class FITKINTERFACEGEOIOHDF5API 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-09-09
*/
void setFileReader(FITKAbstractHDF5Reader* reader);
/**
* @brief INP
* @param writer INP
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-09-09
*/
void setFileWriter(FITKAbstractHDF5Writer* writer);
/**
* @brief H5GroupData
* @param h5Group
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-09-09
*/
void setH5GroupData(H5::Group& h5Group);
/**
* @brief
* @return true false
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-09-09
*/
bool adaptR() override;
/**
* @brief
* @return true false
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-09-09
*/
bool adaptW() override;
/**
* @brief
* @return Status true and false
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-09-09
*/
bool readGeometryAdaptor(Core::FITKAbstractNDataObject* comm, H5::Group & h5Group, QString adaptorName);
/**
* @brief
* @return Status true and false
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-09-09
*/
bool writeGeometryAdaptor(Core::FITKAbstractNDataObject* comm, H5::Group & h5Group, QString adaptorName);
/**
* @brief
* @return truefalse
* @param h5group group
* @param name
* @param str
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-09-09
*/
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-09-09
*/
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-09-09
*/
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-09-09
*/
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-09-09
*/
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-09-09
*/
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-09-09
*/
bool readDoubleAttribute(H5::Group& h5group, std::string name, 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-09-09
*/
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-09-09
*/
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-09-09
*/
int readIntAttribute(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-09-09
*/
bool readIntAttribute(H5::H5Object& h5group, std::string name, int* buff, int n, int m);
/**
* @brief
* @return truefalse
* @param h5group group
* @param name
* @param n
* @param m
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-09-09
*/
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-09-09
*/
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-09-09
*/
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-09-09
*/
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-09-09
*/
void readIntDataSet(H5::H5Object& h5group, std::string name, QList< int >& data);
/**
* @brief Char *
* @param h5group group
* @param name
* @param data
* @param len
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-09-09
*/
bool readCharDataSet(H5::H5Object& h5group, std::string name, char* &data, int len);
/**
* @brief h5group
* @param h5groupgroupnametypebufnm2
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-09-09
*/
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 writeCharDataSet(H5::H5Object& h5group, std::string name, char* &data, int len);
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-09-09
*/
FITKAbstractHDF5Reader* _reader{};
/**
* @brief INP
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-09-09
*/
FITKAbstractHDF5Writer* _writer{};
/**
* @brief H5Group
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-09-09
*/
H5::Group* _h5Group{};
/**
* @brief _h5GroupGroup
* @author fulipeng (fulipengqd@yeah.net)
* @date 2024-09-09
*/
H5::Group _h5CreateGroup;
};
}
#endif