Commit 4e37c830 authored by Joseph Pallamidessi's avatar Joseph Pallamidessi

Fix serializer/deserializer on genome with one struct depth

parent 4d32b3c0
......@@ -259,9 +259,16 @@ void CSymbol::print(FILE *fp)
fprintf(fpOutputFile,"\t\t\tEASEA_Line << \"NULL\" << \" \";\n");
fprintf(fpOutputFile,"}\n");
}
// it's a classical array
else if(pSym->Object->ObjectType==oArray)
{
fprintf(fpOutputFile,"\tfor(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",
pSym->Object->nSize/pSym->Object->pType->nSize);
fprintf(fpOutputFile,"\t\tEASEA_Line << this->%s[EASEA_Ndx] <<\" \";\n", pSym->Object->sName);
}
else
{
// it's not an array of pointers
// it's a pointer to an user-defined clas
fprintf(fpOutputFile,"\tif(this->%s != NULL){\n",pSym->Object->sName);
fprintf(fpOutputFile,"\t\tEASEA_Line << \"\\a \";\n");
fprintf(fpOutputFile,"\t\tEASEA_Line << this->%s->serializer() << \" \";\n",pSym->Object->sName);
......@@ -562,6 +569,19 @@ void CSymbol::serializeIndividual(FILE *fp, char* sCompleteName)
fprintf(fpOutputFile,"}\n");
}
// it's a classical array
else if(pSym->Object->ObjectType==oArray)
{
/*TODO: not clean at all*/
fprintf(fpOutputFile,"\tfor(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",
pSym->Object->nSize/pSym->Object->pType->nSize);
fprintf(fpOutputFile,"\t\tEASEA_Line << this->%s[EASEA_Ndx].serializer() <<\" \";\n", pSym->Object->sName);
}
else if(pSym->Object->ObjectType==oObject)
{
fprintf(fpOutputFile,"\tEASEA_Line << \"\\a \";\n");
fprintf(fpOutputFile,"\tEASEA_Line << this->%s.serializer() << \" \";\n",pSym->Object->sName);
}
else
{
// if it's not an array of pointers
......@@ -675,6 +695,14 @@ void CSymbol::deserializeIndividual(FILE *fp, char* sCompleteName){
fprintf(fpOutputFile,"\t\t}");
fprintf(fpOutputFile,"\t}");
}
else if(pSym->Object->ObjectType==oArray){
fprintf(fpOutputFile,"\tfor(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",pSym->Object->nSize/pSym->Object->pType->nSize);
fprintf(fpOutputFile,"\t\tthis->%s[EASEA_Ndx].deserializer(&EASEA_Line);\n", pSym->Object->sName);
}
else if(pSym->Object->ObjectType==oObject)
{
fprintf(fpOutputFile,"\t this->%s.deserializer(&EASEA_Line);",pSym->Object->sName);
}
else{
fprintf(fpOutputFile,"\tEASEA_Line >> line;\n");
fprintf(fpOutputFile,"\tif(strcmp(line.c_str(),\"NULL\")==0)\n");
......
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