Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 4a950d54 authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Add function to create DataSet in the generated class

parent ddf7ec2b
Pipeline #102728 passed with stages
in 5 minutes and 53 seconds
......@@ -243,6 +243,10 @@ std::string ph5_backendTableHeader(PTable & table){
body += "\t\tvoid write(H5::H5File & file) const;\n";
body += "\t\tvoid write(H5::Group & group) const;\n\n";
body += "\t\tH5::DataSet createDataSet(const std::string & fileName, size_t nbRow) const;\n";
body += "\t\tH5::DataSet createDataSet(H5::H5File & file, size_t nbRow) const;\n";
body += "\t\tH5::DataSet createDataSet(H5::Group & group, size_t nbRow) const;\n\n";
body += ph5_backendTableHeaderRowSetterGetter(table);
body += ph5_backendTableHeaderSetter(table);
......@@ -268,10 +272,10 @@ std::string ph5_backendTableHeader(PTable & table){
}
body += "\n";
}
body += "\tprivate:\n";
body += "\t\tvoid readDataSet(const H5::DataSet & dataset);\n";
body += "\t\tvoid readDataSet(const H5::DataSet & dataset, size_t offset, size_t nbRow);\n";
body += "\t\tvoid writeDataSet(H5::DataSet & dataset) const;\n";
body += "\tprivate:\n";
body += "\t\tvoid allocate(size_t nbRow);\n\n";
body += ph5_backendTableHeaderUpdateArrayDim(table);
......@@ -429,10 +433,7 @@ std::string ph5_backendTableSourceWrite(const PTable & table){
body += "/**\t@param file : HDF5 file to be used\n";
body += "*/\n";
body += "void " + name + "::write(H5::H5File & file) const{\n";
body += "\thsize_t dim[1];\n";
body += "\tdim[0] = p__nbRow;\n";
body += "\tH5::DataSpace space(1, dim);\n";
body += "\tH5::DataSet dataset = file.createDataSet(p__tableName, getCompTypeAll(), space);\n";
body += "\tH5::DataSet dataset = createDataSet(file, p__nbRow);\n";
body += "\twriteDataSet(dataset);\n";
body += "}\n\n";
......@@ -440,12 +441,54 @@ std::string ph5_backendTableSourceWrite(const PTable & table){
body += "/**\t@param group : HDF5 group to be used\n";
body += "*/\n";
body += "void " + name + "::write(H5::Group & group) const{\n";
body += "\tH5::DataSet dataset = createDataSet(group, p__nbRow);\n";
body += "\twriteDataSet(dataset);\n";
body += "}\n\n";
return body;
}
///Save the source of the given PTable
/** @param table : PTable to be used
* @return corresponding string
*/
std::string ph5_backendTableSourceCreateDataSet(const PTable & table){
std::string body(""), name(table.getName());
body += "///Create and write the table " + name + " in given file\n";
body += "/**\t@param fileName : name of the HDF5 file to be used\n";
body += " * \t@param nbRow : full number of rows in the DataSet\n";
body += " * \t@return created DataSet\n";
body += "*/\n";
body += "H5::DataSet " + name + "::createDataSet(const std::string & fileName, size_t nbRow) const{\n";
body += "\tH5::H5File file(fileName, H5F_ACC_TRUNC);\n";
body += "\treturn createDataSet(file, nbRow);\n";
body += "}\n\n";
body += "///Create the DataSet of the table " + name + " in given file\n";
body += "/**\t@param file : HDF5 file to be used\n";
body += " * \t@param nbRow : full number of rows in the DataSet\n";
body += " * \t@return created DataSet\n";
body += "*/\n";
body += "H5::DataSet " + name + "::createDataSet(H5::H5File & file, size_t nbRow) const{\n";
body += "\thsize_t dim[1];\n";
body += "\tdim[0] = nbRow;\n";
body += "\tH5::DataSpace space(1, dim);\n";
body += "\tH5::DataSet dataset = file.createDataSet(p__tableName, getCompTypeAll(), space);\n";
body += "\treturn dataset;\n";
body += "}\n\n";
body += "///Create the DataSet of the table " + name + " in given group\n";
body += "/**\t@param group : HDF5 group to be used\n";
body += " * \t@param nbRow : full number of rows in the DataSet\n";
body += " * \t@return created DataSet\n";
body += "*/\n";
body += "H5::DataSet " + name + "::createDataSet(H5::Group & group, size_t nbRow) const{\n";
body += "\thsize_t dim[1];\n";
body += "\tdim[0] = p__nbRow;\n";
body += "\tdim[0] = nbRow;\n";
body += "\tH5::DataSpace space(1, dim);\n";
body += "\tH5::DataSet dataset = group.createDataSet(p__tableName, getCompTypeAll(), space);\n";
body += "\twriteDataSet(dataset);\n";
body += "\treturn dataset;\n";
body += "}\n\n";
return body;
}
......@@ -975,6 +1018,7 @@ std::string ph5_backendTableSource(PTable & table){
body += ph5_backendTableSourceRead(table);
body += ph5_backendTableSourceWrite(table);
body += ph5_backendTableSourceCreateDataSet(table);
body += ph5_backendTableSourceRowSetterGetter(table);
body += ph5_backendTableSourceSetter(table);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment