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