Commit 97f7484e authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Add method to set the hdf5 name of the Table

parent f7dec3c8
Pipeline #94695 canceled with stages
......@@ -226,6 +226,7 @@ std::string ph5_backendTableHeader(PTable & table){
body += "\t\t" + name + "();\n";
body += "\t\tvirtual ~" + name + "();\n\n";
body += "\t\tvoid setTableName(const std::string & name);\n";
body += "\t\tsize_t getNbRow() const;\n";
body += "\t\tvoid resize(size_t nbRow);\n";
body += "\t\tvoid clear();\n\n";
......@@ -272,6 +273,8 @@ std::string ph5_backendTableHeader(PTable & table){
body += "\n";
body += "\t\t///Number of rows in the table "+name+"\n";
body += "\t\tsize_t p__nbRow;\n\n";
body += "\t\t///HDF5 name of the table "+name+"\n";
body += "\t\tstd::string p__tableName;\n\n";
if(vecDimVar.size() != 0lu){
for(PVecStr::iterator it(vecDimVar.begin()); it != vecDimVar.end(); ++it){
......@@ -394,7 +397,7 @@ std::string ph5_backendTableSourceWrite(const PTable & table){
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(\""+table.getDataSetName()+"\", getCompTypeAll(), space);\n";
body += "\tH5::DataSet dataset = file.createDataSet(\"p__tableName\", getCompTypeAll(), space);\n";
body += "\twriteDataSet(dataset);\n";
body += "}\n\n";
......@@ -405,7 +408,7 @@ std::string ph5_backendTableSourceWrite(const PTable & table){
body += "\thsize_t dim[1];\n";
body += "\tdim[0] = p__nbRow;\n";
body += "\tH5::DataSpace space(1, dim);\n";
body += "\tH5::DataSet dataset = group.createDataSet(\""+table.getDataSetName()+"\", getCompTypeAll(), space);\n";
body += "\tH5::DataSet dataset = group.createDataSet(\"p__tableName\", getCompTypeAll(), space);\n";
body += "\twriteDataSet(dataset);\n";
body += "}\n\n";
return body;
......@@ -868,6 +871,7 @@ std::string ph5_backendTableSource(PTable & table){
body += "///Constructor of the class " + name + "\n";
body += name + "::" + name + "(){\n";
body += "\tp__nbRow = 0lu;\n";
body += "\tp__tableName = \""+table.getDataSetName()+"\";\n";
PVecStr vecDimVar = ph5_getDimName(table);
for(PVecStr::iterator it(vecDimVar.begin()); it != vecDimVar.end(); ++it){
body += "\tp_" + (*it) + " = 0lu;\n";
......@@ -882,6 +886,13 @@ std::string ph5_backendTableSource(PTable & table){
body += "\tclear();\n";
body += "}\n\n";
body += "///Set the HDF5 name of the Table " + name + "\n";
body += "/**\t@param name : name of the table to be saved\n";
body += "*/";
body += "void " + name + "::setTableName(const std::string & name){\n";
body += "\tp__tableName = name;\n";
body += "}\n\n";
body += "///Get the total number of rows in the current Table " + name + "\n";
body += "/**\t@return total number of rows\n";
body += "*/";
......
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