-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbtree.h
55 lines (43 loc) · 1.09 KB
/
btree.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef _BTREE_H
#define _BTREE_H
/**
* A BoolTree is a boolean tree representing a function.
* each node is a BoolNode
* each leaf is a value for correspondant path (from root)
* Exemple: a->b->c->1 means : a*b*c = 1
*/
typedef struct _BoolTree BoolTree;
typedef struct _BoolNode BoolNode;
#include "globals.h"
#include "ftree.h"
/**
* Create a bool tree with a node as root
*/
extern BoolTree* btree_createTreeWith(BoolNode* root);
/**
* Create a new node for variable var with left and right childs
*/
extern BoolNode* btree_newNode(BoolNode* l, char var, BoolNode* r);
extern void btree_free(BoolTree* tree);
/**
* Create a new leaf with value b
*/
extern BoolNode* btree_newLeaf(int b);
/**
* Are two btree equals ?
*/
extern int btree_equals(BoolNode* a, BoolNode* b);
/**
* Print a btree as Dot format into out
*/
extern void btree_printDot(BoolTree* btree, FILE* out);
/**
* Simplify a BoolTree as BDD
*/
extern BoolTree* btree_simplify(BoolTree*);
/// Converters
/**
* create a function tree with a btree
*/
extern FunctionTree* btree_toFunctionTree(BoolTree* tree);
#endif