source: vis_dev/glu-2.3/src/cuBdd/doc/node5.html @ 104

Last change on this file since 104 was 13, checked in by cecile, 13 years ago

library glu 2.3

File size: 3.8 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2
3<!--Converted with LaTeX2HTML 2K.1beta (1.47)
4original 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 &nbsp <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>
73The C++ Interface
74</H1>
75
76<P>
77
78<H2><A NAME="SECTION00051000000000000000"></A>
79<A NAME="sec:compileCpp"></A>
80<BR>
81Compiling and Linking
82</H2>
83
84<P>
85To build an application that uses the CUDD C++ interface, you should
86add
87<PRE>
88#include "cuddObj.hh"
89</PRE>
90to your source files. In addition to the normal CUDD libraries (see
91Section&nbsp;<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
94distribution for further details.
95
96<P>
97
98<H2><A NAME="SECTION00052000000000000000"></A>
99<A NAME="sec:basicCpp"></A>
100<BR>
101Basic Manipulation
102</H2>
103
104<P>
105The following fragment of code illustrates some simple operations on
106BDDs 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 &lt;&lt; "f is" &lt;&lt; (f &lt;= g ? "" : " not")
114             &lt;&lt; " less than or equal to g\n";
115</PRE>
116This code creates a manager called <code>mgr</code> and two variables in it.
117It then defines two functions <code>f</code> and <code>g</code> in terms of the
118variables. Finally, it prints a message based on the comparison of the
119two functions. No explicit referencing or dereferencing is required.
120The operators are overloaded in the intuitive way. BDDs are freed when
121execution leaves the scope in which they are defined or when the
122variables referring to them are overwritten.
123
124<P>
125<BR><HR>
126<ADDRESS>
127Fabio Somenzi
1282005-05-17
129</ADDRESS>
130</BODY>
131</HTML>
Note: See TracBrowser for help on using the repository browser.