next up previous index
Next: Acknowledgments Up: CUDD: CU Decision Diagram Previous: Programmer's Manual   Index

Subsections


The C++ Interface


Compiling and Linking

To build an application that uses the CUDD C++ interface, you should add

#include "cuddObj.hh"
to your source files. In addition to the normal CUDD libraries (see Section 3.1) you should link libobj.a to your executable. Refer to the Makefile in the top level directory of the distribution for further details.


Basic Manipulation

The following fragment of code illustrates some simple operations on BDDs using the C++ interface.

	Cudd mgr(0,0);
	BDD x = mgr.bddVar();
	BDD y = mgr.bddVar();
	BDD f = x * y;
	BDD g = y + !x;
	cout << "f is" << (f <= g ? "" : " not")
	     << " less than or equal to g\n";
This code creates a manager called mgr and two variables in it. It then defines two functions f and g in terms of the variables. Finally, it prints a message based on the comparison of the two functions. No explicit referencing or dereferencing is required. The operators are overloaded in the intuitive way. BDDs are freed when execution leaves the scope in which they are defined or when the variables referring to them are overwritten.



Fabio Somenzi 2012-02-04