|
NMD
|

Go to the source code of this file.
Functions | |
| int | main (int argc, char **argv) |
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Object cloning and reporting in the presence of place holder empty components
Definition at line 7 of file u16.c.
References NMD_FREE, NMDCloneObject(), NMDCreateObject(), NMDDestroyObject(), NMDFalse, NMDInt, NMDObjectEnsureCategoryComponent(), NMDReal, NMDReportObject(), and NMDSetValue().
{
NMD_metadata nmd,nmd2; NMDErrorCode ierr;
int i=5;
PetscFunctionBegin;
PetscInitialize(&argc,&argv,0,0);
ierr = NMDCreateObject(&nmd); NMD_ERR_RETURN(ierr);
ierr = NMDCreateObject(&nmd2); NMD_ERR_RETURN(ierr);
ierr = NMDSetValue(nmd,"cat1","cmp1",NMDInt,&i); NMD_ERR_RETURN(ierr);
ierr = NMDObjectEnsureCategoryComponent
(nmd,"cat1","cmp2",NMDReal,NULL); NMD_ERR_RETURN(ierr);
ierr = NMDCloneObject(nmd,nmd2); NMD_ERR_RETURN(ierr);
{
const char *s1,*s2;
/* report the original object */
ierr = NMDReportObject(nmd,NMDFalse,&s1,&s2,'\n',0,0); NMD_ERR_RETURN(ierr);
printf("original keys:\n%s\nvalues:\n%s\n",s1,s2);
NMD_FREE(s1);
NMD_FREE(s2);
/* report the clone */
ierr = NMDReportObject(nmd2,NMDFalse,&s1,&s2,'\n',0,0); NMD_ERR_RETURN(ierr);
printf("clone keys:\n%s\nvalues:\n%s\n",s1,s2);
NMD_FREE(s1);
NMD_FREE(s2);
}
ierr = NMDDestroyObject(nmd); NMD_ERR_RETURN(ierr);
ierr = NMDDestroyObject(nmd2); NMD_ERR_RETURN(ierr);
PetscFinalize();
PetscFunctionReturn(0);
}

1.7.6.1