# bag.cpp File Reference

`#include "bag.h"`
`#include <bdd.h>`
`#include <iostream>`
`#include <bitset>`

## Functions
double | getOcc (bdd feature, bdd family)
bdd | setOcc (int feature, int occ, bdd &family)
bdd | bagUnion (bdd b1, bdd b2)
bdd | bagIntersection (bdd b1, bdd b2)
bool | bagIsMember (bdd feature, bdd family)
bdd | bagComplement (bdd family)
void | bagInsert (bdd feature, bdd &family)
void | bagRemove (bdd feature, bdd &family)
bool | bagIsEmpty (bdd family)
void | bagEnumerate (bdd family)
## Variables
bitset< 3 > | bs
bdd | temp1

## Function Documentation

bdd bagComplement | ( | bdd | family | ) |

This function returns the bag complement of a given bag, family. There is theoritically no bag complement, but we can se our own. One example is to define a maximum number of occurances.

void bagEnumerate | ( | bdd | family | ) |

This functions displays the content of a given bag, family. The format is like in this example: {(1,3),(2,5)}. This is element 1 of 3 occurances and element 2 of 5 occurances.

void bagInsert | ( | bdd | feature,
|  | bdd & | family |
| ) |  |  |

This function inserts an element, feature, into a bag, family.

bdd bagIntersection | ( | bdd | b1,
|  | bdd | b2 |
| ) |  |  |

This function returns the bag intersection between two given bags b1,b2. The the result will contain the elements that the given original bags contain.

bool bagIsEmpty | ( | bdd | family | ) |

This function checks if a bag, family, is empty; if so, it returns true and false otherwise.

bool bagIsMember | ( | bdd | feature,
|  | bdd | family |
| ) |  |  |

This function returns true if a given element, feature, is a member of a bag, family. It returns false otherwise.

void bagRemove | ( | bdd | feature,
|  | bdd & | family |
| ) |  |  |

This function removes an element, feature, from a bag, family.

bdd bagUnion | ( | bdd | b1,
|  | bdd | b2 |
| ) |  |  |

This functions unions two bags, b1 and b2, and returns the resultant bag containing the elements in the original two bags.

double getOcc | ( | bdd | feature,
|  | bdd | family |
| ) |  |  |

Given an element, and a bag, this function get the number of occurances of that element in the bag.

bdd setOcc | ( | int | feature,
|  | int | occ,
|  | bdd & | family |
| ) |  |  |

Given an element number, the number of occurances and a bag, family, this funciton sets the number of occurances of the element in the family. The function returns a bag(bdd) with the occurance changed.

## Variable Documentation

bitset<3> bs

bdd temp1