Content  


Basic Usage

In this example the access to basic datastructures defined in the ViennaIPD file, which has been introduced in the first example, is depicted.

 

Basic ViennaIPD API usage
  1. #include "ipd.h"
  2.  
  3. int main(int argc, char** argv)
  4. {
  5. // some variables
  6. ipdLong i;
  7. ipdChar *s;
  8. // inititalize the ViennaIPD library
  9. ipdInit(NULL, NULL);
  10. // create a database with an arbitrary name
  11. ipdCreateBase("NameOfTheDatabase", 0);
  12. // read a ViennaIPD file
  13. ipdReadInputDeck("viennaipd.ipd");
  14.  
  15. // access the data of various ViennaIPD objects
  16. ipdGetStringByName("~a", &s);
  17. printf("Value of ~a: %s\n", s);
  18.  
  19. // member data can be accessed too
  20. ipdGetIntegerByName("~Double.d", &i);
  21. printf("Value of ~Double.d: %d\n", i);
  22.  
  23. // free the ViennaIPD internal datastructures
  24. ipdFreeAll();
  25.  
  26. return 0;
  27. }