emergency commit
[cl-cudd.git] / distr / cudd / doc / node5.html
blob6912b76fc1e318c3509f25276a94fee2443fc789
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
3 <!--Converted with jLaTeX2HTML 2002-2-1 (1.70) JA patch-2.0
4 patched version by: Kenshi Muto, Debian Project.
5 * modified by: Shige TAKENO
6 LaTeX2HTML 2002-2-1 (1.70),
7 original version by: Nikos Drakos, CBLU, University of Leeds
8 * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
9 * with significant contributions from:
10 Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
11 <HTML>
12 <HEAD>
13 <TITLE>The C++ Interface</TITLE>
14 <META NAME="description" CONTENT="The C++ Interface">
15 <META NAME="keywords" CONTENT="cuddIntro">
16 <META NAME="resource-type" CONTENT="document">
17 <META NAME="distribution" CONTENT="global">
19 <META NAME="Generator" CONTENT="jLaTeX2HTML v2002-2-1 JA patch-2.0">
20 <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
22 <LINK REL="STYLESHEET" HREF="cuddIntro.css">
24 <LINK REL="next" HREF="node6.html">
25 <LINK REL="previous" HREF="node4.html">
26 <LINK REL="up" HREF="cuddIntro.html">
27 <LINK REL="next" HREF="node6.html">
28 </HEAD>
30 <BODY >
31 <!--Navigation Panel-->
32 <A NAME="tex2html182"
33 HREF="node6.html">
34 <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
35 SRC="icons/next.png"></A>
36 <A NAME="tex2html178"
37 HREF="cuddIntro.html">
38 <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
39 SRC="icons/up.png"></A>
40 <A NAME="tex2html172"
41 HREF="node4.html">
42 <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
43 SRC="icons/prev.png"></A>
44 <A NAME="tex2html180"
45 HREF="node8.html">
46 <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
47 SRC="icons/index.png"></A>
48 <BR>
49 <B> Next:</B> <A NAME="tex2html183"
50 HREF="node6.html">Acknowledgments</A>
51 <B> Up:</B> <A NAME="tex2html179"
52 HREF="cuddIntro.html">CUDD: CU Decision Diagram</A>
53 <B> Previous:</B> <A NAME="tex2html173"
54 HREF="node4.html">Programmer's Manual</A>
55 &nbsp; <B> <A NAME="tex2html181"
56 HREF="node8.html">Index</A></B>
57 <BR>
58 <BR>
59 <!--End of Navigation Panel-->
60 <!--Table of Child-Links-->
61 <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
63 <UL>
64 <LI><A NAME="tex2html184"
65 HREF="node5.html#SECTION00051000000000000000">Compiling and Linking</A>
66 <LI><A NAME="tex2html185"
67 HREF="node5.html#SECTION00052000000000000000">Basic Manipulation</A>
68 </UL>
69 <!--End of Table of Child-Links-->
70 <HR>
72 <H1><A NAME="SECTION00050000000000000000"></A>
73 <A NAME="sec:cpp"></A>
74 <BR>
75 The C++ Interface
76 </H1>
78 <P>
80 <H2><A NAME="SECTION00051000000000000000"></A>
81 <A NAME="sec:compileCpp"></A>
82 <BR>
83 Compiling and Linking
84 </H2>
86 <P>
87 To build an application that uses the CUDD C++ interface, you should
88 add
89 <PRE>
90 #include "cuddObj.hh"
91 </PRE>
92 to your source files. In addition to the normal CUDD libraries (see
93 Section&nbsp;<A HREF="node3.html#sec:compileExt">3.1</A>) you should link
94 <code>libobj.a</code><A NAME="1044"></A> to your executable. Refer to the
95 <TT>Makefile<A NAME="1045"></A></TT> in the top level directory of the
96 distribution for further details.
98 <P>
100 <H2><A NAME="SECTION00052000000000000000"></A>
101 <A NAME="sec:basicCpp"></A>
102 <BR>
103 Basic Manipulation
104 </H2>
107 The following fragment of code illustrates some simple operations on
108 BDDs using the C++ interface.
109 <PRE>
110 Cudd mgr(0,0);
111 BDD x = mgr.bddVar();
112 BDD y = mgr.bddVar();
113 BDD f = x * y;
114 BDD g = y + !x;
115 cout &lt;&lt; "f is" &lt;&lt; (f &lt;= g ? "" : " not")
116 &lt;&lt; " less than or equal to g\n";
117 </PRE>
118 This code creates a manager called <code>mgr</code> and two variables in it.
119 It then defines two functions <code>f</code> and <code>g</code> in terms of the
120 variables. Finally, it prints a message based on the comparison of the
121 two functions. No explicit referencing or dereferencing is required.
122 The operators are overloaded in the intuitive way. BDDs are freed when
123 execution leaves the scope in which they are defined or when the
124 variables referring to them are overwritten.
127 <HR>
128 <!--Navigation Panel-->
129 <A NAME="tex2html182"
130 HREF="node6.html">
131 <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
132 SRC="icons/next.png"></A>
133 <A NAME="tex2html178"
134 HREF="cuddIntro.html">
135 <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
136 SRC="icons/up.png"></A>
137 <A NAME="tex2html172"
138 HREF="node4.html">
139 <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
140 SRC="icons/prev.png"></A>
141 <A NAME="tex2html180"
142 HREF="node8.html">
143 <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
144 SRC="icons/index.png"></A>
145 <BR>
146 <B> Next:</B> <A NAME="tex2html183"
147 HREF="node6.html">Acknowledgments</A>
148 <B> Up:</B> <A NAME="tex2html179"
149 HREF="cuddIntro.html">CUDD: CU Decision Diagram</A>
150 <B> Previous:</B> <A NAME="tex2html173"
151 HREF="node4.html">Programmer's Manual</A>
152 &nbsp; <B> <A NAME="tex2html181"
153 HREF="node8.html">Index</A></B>
154 <!--End of Navigation Panel-->
155 <ADDRESS>
156 Fabio Somenzi
157 2009-02-20
158 </ADDRESS>
159 </BODY>
160 </HTML>