NMD
Functions
nmdtest.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include "nmd.h"
Include dependency graph for nmdtest.c:

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 5 of file nmdtest.c.

References NMDCreateObject(), NMDGetValue(), NMDInt, NMDReal, and NMDSetValue().

{
  NMD_metadata nmd; int i,ierr; double r;

  ierr = NMDCreateObject(&nmd); NMD_ERR_RETURN(ierr);
  ierr = NMDCreateCategory(nmd,"first cat"); NMD_ERR_RETURN(ierr);
  ierr = NMDCreateCategory(nmd,"second cat"); NMD_ERR_RETURN(ierr);
  ierr = NMDCreateComponent(nmd,"first cat","i1",NMDInt); NMD_ERR_RETURN(ierr);
  ierr = NMDCreateComponent(nmd,"first cat","i2",NMDInt); NMD_ERR_RETURN(ierr);
  ierr = NMDCreateComponent(nmd,"first cat","r1",NMDReal); NMD_ERR_RETURN(ierr);

  i = 3;
  ierr = NMDSetValue(nmd,"first cat","i1",(void*)&i); NMD_ERR_RETURN(ierr);
  r = 7.2;
  ierr = NMDSetValue(nmd,"first cat","r1",(void*)&r); NMD_ERR_RETURN(ierr);
  i = 8;
  ierr = NMDSetValue(nmd,"first cat","i2",(void*)&i); NMD_ERR_RETURN(ierr);

  ierr = NMDGetValue(nmd,"first cat","i1",NULL,(void*)&i); NMD_ERR_RETURN(ierr);
  printf("3 = %d\n",i);
  ierr = NMDGetValue(nmd,"first cat","r1",NULL,(void*)&r); NMD_ERR_RETURN(ierr);
  printf("7.2 = %e\n",r);
  ierr = NMDGetValue(nmd,"first cat","i2",NULL,(void*)&i); NMD_ERR_RETURN(ierr);
  printf("8 = %d\n",i);

  return 0;
}

Here is the call graph for this function: