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

Commit c2eacb80 authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Add openDataSet method in generated classes

parent a95c0e03
Pipeline #103280 passed with stages
in 12 minutes and 8 seconds
......@@ -247,6 +247,10 @@ std::string ph5_backendTableHeader(PTable & table){
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 += "\t\tH5::DataSet openDataSet(const std::string & fileName) const;\n";
body += "\t\tH5::DataSet openDataSet(const H5::H5File & file) const;\n";
body += "\t\tH5::DataSet openDataSet(const H5::Group & group) const;\n\n";
body += ph5_backendTableHeaderRowSetterGetter(table);
body += ph5_backendTableHeaderSetter(table);
......@@ -371,7 +375,7 @@ std::string ph5_backendTableSourceRead(const PTable & table){
body += "/**\t@param file : HDF5 file to be used\n";
body += "*/\n";
body += "void " + name + "::read(const H5::H5File & file){\n";
body += "\tH5::DataSet dataset = file.openDataSet(p__tableName);\n";
body += "\tH5::DataSet dataset = openDataSet(file);\n";
body += "\treadDataSet(dataset);\n";
body += "}\n\n";
......@@ -379,7 +383,7 @@ std::string ph5_backendTableSourceRead(const PTable & table){
body += "/**\t@param group : HDF5 group to be used\n";
body += "*/\n";
body += "void " + name + "::read(const H5::Group & group){\n";
body += "\tH5::DataSet dataset = group.openDataSet(p__tableName);\n";
body += "\tH5::DataSet dataset = openDataSet(group);\n";
body += "\treadDataSet(dataset);\n";
body += "}\n\n";
......@@ -399,7 +403,7 @@ std::string ph5_backendTableSourceRead(const PTable & table){
body += " * \t@param nbRow : number of rows the "+name+" class needs to load (Will reallocate the "+name+" is the number of rows is greater than the number off already allocated rows)\n";
body += "*/\n";
body += "void " + name + "::read(const H5::H5File & file, size_t offset, size_t nbRow){\n";
body += "\tH5::DataSet dataset = file.openDataSet(p__tableName);\n";
body += "\tH5::DataSet dataset = openDataSet(file);\n";
body += "\treadDataSet(dataset, offset, nbRow);\n";
body += "}\n\n";
......@@ -409,7 +413,7 @@ std::string ph5_backendTableSourceRead(const PTable & table){
body += " * \t@param nbRow : number of rows the "+name+" class needs to load (Will reallocate the "+name+" is the number of rows is greater than the number off already allocated rows)\n";
body += "*/\n";
body += "void " + name + "::read(const H5::Group & group, size_t offset, size_t nbRow){\n";
body += "\tH5::DataSet dataset = group.openDataSet(p__tableName);\n";
body += "\tH5::DataSet dataset = openDataSet(group);\n";
body += "\treadDataSet(dataset, offset, nbRow);\n";
body += "}\n\n";
return body;
......@@ -492,6 +496,42 @@ std::string ph5_backendTableSourceCreateDataSet(const PTable & table){
return body;
}
///Save the source of the given PTable
/** @param table : PTable to be used
* @return corresponding string
*/
std::string ph5_backendTableSourceOpenDataSet(const PTable & table){
std::string body(""), name(table.getName());
body += "///Open and write the table " + name + " in given file\n";
body += "/**\t@param fileName : name of the HDF5 file to be used\n";
body += " * \t@return opened DataSet\n";
body += "*/\n";
body += "H5::DataSet " + name + "::openDataSet(const std::string & fileName) const{\n";
body += "\tH5::H5File file(fileName, H5F_ACC_RDONLY);\n";
body += "\treturn openDataSet(file);\n";
body += "}\n\n";
body += "///Open the DataSet of the table " + name + " in given file\n";
body += "/**\t@param file : HDF5 file to be used\n";
body += " * \t@return opened DataSet\n";
body += "*/\n";
body += "H5::DataSet " + name + "::openDataSet(const H5::H5File & file) const{\n";
body += "\tH5::DataSet dataset = file.openDataSet(p__tableName);\n";
body += "\treturn dataset;\n";
body += "}\n\n";
body += "///Open the DataSet of the table " + name + " in given group\n";
body += "/**\t@param group : HDF5 group to be used\n";
body += " * \t@return opened DataSet\n";
body += "*/\n";
body += "H5::DataSet " + name + "::openDataSet(const H5::Group & group) const{\n";
body += "\tH5::DataSet dataset = group.openDataSet(p__tableName);\n";
body += "\treturn dataset;\n";
body += "}\n\n";
return body;
}
///Save the header of the given PTable
/** @param table : PTable to be used
* @return corresponding string
......@@ -1019,6 +1059,7 @@ std::string ph5_backendTableSource(PTable & table){
body += ph5_backendTableSourceRead(table);
body += ph5_backendTableSourceWrite(table);
body += ph5_backendTableSourceCreateDataSet(table);
body += ph5_backendTableSourceOpenDataSet(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