You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
3.7 KiB

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  2. <!--Converted with LaTeX2HTML 2008 (1.71)
  3. original version by: Nikos Drakos, CBLU, University of Leeds
  4. * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
  5. * with significant contributions from:
  6. Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
  7. <HTML>
  8. <HEAD>
  9. <TITLE>The C++ Interface</TITLE>
  10. <META NAME="description" CONTENT="The C++ Interface">
  11. <META NAME="keywords" CONTENT="cuddIntro">
  12. <META NAME="resource-type" CONTENT="document">
  13. <META NAME="distribution" CONTENT="global">
  14. <META NAME="Generator" CONTENT="LaTeX2HTML v2008">
  15. <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
  16. <LINK REL="STYLESHEET" HREF="cuddIntro.css">
  17. <LINK REL="next" HREF="node6.html">
  18. <LINK REL="previous" HREF="node4.html">
  19. <LINK REL="up" HREF="cuddIntro.html">
  20. <LINK REL="next" HREF="node6.html">
  21. </HEAD>
  22. <BODY >
  23. <!--Navigation Panel-->
  24. <A NAME="tex2html184"
  25. HREF="node6.html">
  26. <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
  27. SRC="icons/next.png"></A>
  28. <A NAME="tex2html180"
  29. HREF="cuddIntro.html">
  30. <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
  31. SRC="icons/up.png"></A>
  32. <A NAME="tex2html174"
  33. HREF="node4.html">
  34. <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
  35. SRC="icons/prev.png"></A>
  36. <A NAME="tex2html182"
  37. HREF="node8.html">
  38. <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
  39. SRC="icons/index.png"></A>
  40. <BR>
  41. <B> Next:</B> <A NAME="tex2html185"
  42. HREF="node6.html">Acknowledgments</A>
  43. <B> Up:</B> <A NAME="tex2html181"
  44. HREF="cuddIntro.html">CUDD: CU Decision Diagram</A>
  45. <B> Previous:</B> <A NAME="tex2html175"
  46. HREF="node4.html">Programmer's Manual</A>
  47. &nbsp; <B> <A NAME="tex2html183"
  48. HREF="node8.html">Index</A></B>
  49. <BR>
  50. <BR>
  51. <!--End of Navigation Panel-->
  52. <!--Table of Child-Links-->
  53. <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
  54. <UL>
  55. <LI><A NAME="tex2html186"
  56. HREF="node5.html#SECTION00051000000000000000">Compiling and Linking</A>
  57. <LI><A NAME="tex2html187"
  58. HREF="node5.html#SECTION00052000000000000000">Basic Manipulation</A>
  59. </UL>
  60. <!--End of Table of Child-Links-->
  61. <HR>
  62. <H1><A NAME="SECTION00050000000000000000"></A>
  63. <A NAME="sec:cpp"></A>
  64. <BR>
  65. The C++ Interface
  66. </H1>
  67. <P>
  68. <H2><A NAME="SECTION00051000000000000000"></A>
  69. <A NAME="sec:compileCpp"></A>
  70. <BR>
  71. Compiling and Linking
  72. </H2>
  73. <P>
  74. To build an application that uses the CUDD C++ interface, you should
  75. add
  76. <PRE>
  77. #include "cuddObj.hh"
  78. </PRE>
  79. to your source files. In addition to the normal CUDD libraries (see
  80. Section&nbsp;<A HREF="node3.html#sec:compileExt">3.1</A>) you should link
  81. <code>libobj.a</code><A NAME="1051"></A> to your executable. Refer to the
  82. <TT>Makefile<A NAME="1052"></A></TT> in the top level directory of the
  83. distribution for further details.
  84. <P>
  85. <H2><A NAME="SECTION00052000000000000000"></A>
  86. <A NAME="sec:basicCpp"></A>
  87. <BR>
  88. Basic Manipulation
  89. </H2>
  90. <P>
  91. The following fragment of code illustrates some simple operations on
  92. BDDs using the C++ interface.
  93. <PRE>
  94. Cudd mgr(0,0);
  95. BDD x = mgr.bddVar();
  96. BDD y = mgr.bddVar();
  97. BDD f = x * y;
  98. BDD g = y + !x;
  99. cout &lt;&lt; "f is" &lt;&lt; (f &lt;= g ? "" : " not")
  100. &lt;&lt; " less than or equal to g\n";
  101. </PRE>
  102. This code creates a manager called <code>mgr</code> and two variables in it.
  103. It then defines two functions <code>f</code> and <code>g</code> in terms of the
  104. variables. Finally, it prints a message based on the comparison of the
  105. two functions. No explicit referencing or dereferencing is required.
  106. The operators are overloaded in the intuitive way. BDDs are freed when
  107. execution leaves the scope in which they are defined or when the
  108. variables referring to them are overwritten.
  109. <P>
  110. <BR><HR>
  111. <ADDRESS>
  112. Fabio Somenzi
  113. 2012-02-04
  114. </ADDRESS>
  115. </BODY>
  116. </HTML>