- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Mers::Generators::BFIG::BFIGImplicantHeap Class Reference

`#include <BFIGImplicantHeap.h>`

Inheritance diagram for Mers::Generators::BFIG::BFIGImplicantHeap:

[legend]
Collaboration diagram for Mers::Generators::BFIG::BFIGImplicantHeap:

[legend]
List of all members.

## Public Types
typedef BFIGImplicant | HeapElement
| the element type of this class
## Public Member Functions
| BFIGImplicantHeap (bool greatestOnTop, double maximumCost, bool owner)
| BFIGImplicantHeap (bool greatestOnTop, bool owner)
virtual | ~BFIGImplicantHeap ()
int | insert (HeapElement *element)
int | peekFirst (HeapElement *&element)
int | getFirst (HeapElement *&element)
HeapElement *& | operator[] (int elementIndex)
HeapElement *& | operator[] (unsigned int elementIndex)
HeapElement const *& | operator[] (int elementIndex) const
HeapElement const *& | operator[] (unsigned int elementIndex) const
## Protected Member Functions
virtual void | printElement (std::ostream &out, void const *element) const
virtual void | deleteElement (void *element) const
virtual void * | newElement (void const *element) const
virtual bool | greaterThan (void const *e1, void const *e2) const
virtual bool | lessThan (void const *e1, void const *e2) const
## Protected Attributes
const bool | mPruneByCost
const double | mMaximumCost

## Detailed Description

A heap that stores Implicants in best first order.

Definition at line 36 of file BFIGImplicantHeap.h.

## Constructor & Destructor Documentation

BFIGImplicantHeap::BFIGImplicantHeap | ( | bool | greatestOnTop,
|  | double | maximumCost,
|  | bool | owner |
| ) |  |  |

Creates a new BFIG Implicant Heap that can be used as a priority queue.

Parameters:

  | greatestOnTop | set this to true to have the top element be the largest element in the heap, set it to false to have it be the smallest element in the heap
  | maximumCost | The maximum cost of an implicant before it is discarded when attempting to add it to the heap.
  | owner | The ownership status. If true, this object owns the array objects it contains and should delete them upon being deleted.

Definition at line 27 of file BFIGImplicantHeap.cpp.

BFIGImplicantHeap::BFIGImplicantHeap | ( | bool | greatestOnTop,
|  | bool | owner |
| ) |  |  |

Creates a new BFIG Implicant Heap that can be used as a priority queue.

Parameters:

  | greatestOnTop | set this to true to have the top element be the largest element in the heap, set it to false to have it be the smallest element in the heap
  | owner | The ownership status. If true, this object owns the array objects it contains and should delete them upon being deleted.

Definition at line 37 of file BFIGImplicantHeap.cpp.

BFIGImplicantHeap::~BFIGImplicantHeap | ( |  | ) | `[virtual]`

Destroys this objects

Definition at line 45 of file BFIGImplicantHeap.cpp.

References Mers::Utils::Containers::DynamicArray::makeEmpty().

Here is the call graph for this function:

## Member Function Documentation

int BFIGImplicantHeap::insert | ( | HeapElement * | element | ) |

inserts a new element into the heap This object assumes ownership of the element

Parameters:

  | element | the new element being inserted in the heap

Returns:
  0 on success or a positive number if there was insufficient room

Definition at line 52 of file BFIGImplicantHeap.cpp.

References Mers::Generators::BFIG::BFIGImplicant::getBestCost(), mMaximumCost, mPruneByCost, and Mers::Utils::Containers::DynamicArray::ownsElements.

Referenced by Mers::Generators::BFIG::BFIG::addConflict(), Mers::Generators::BFIG::BFIG::enqueueImplicant(), and Mers::Generators::BFIG::BFIG::restart().

Here is the call graph for this function:

int BFIGImplicantHeap::peekFirst | ( | HeapElement *& | element | ) |

returns the first (largest/smallest) element in the heap, if any but leaves it on the heap

Parameters:

  | element | the first element is returned here

Returns:
  0 on success or a positive number if the heap was empty, this also sets element to NULL

Definition at line 69 of file BFIGImplicantHeap.cpp.

int BFIGImplicantHeap::getFirst | ( | HeapElement *& | element | ) |

returns the first (largest/smallest) element in the heap and then removes it from the heap. This object relinquishes control of element.

Parameters:

  | element | the first element is returned here

Returns:
  0 on success or a positive number if the heap was empty, this also sets element to NULL

Definition at line 76 of file BFIGImplicantHeap.cpp.

HeapElement* & Mers::Generators::BFIG::BFIGImplicantHeap::operator[] | ( | int | elementIndex | ) | `[inline]`

retrieves the element at the specified index and returns it

Parameters:

  | elementIndex | location of the element to be accessed

Returns:
  the element requested if index is in range, otherwise it returns NULL

Reimplemented from Mers::Utils::Containers::DynamicArray.

Definition at line 122 of file BFIGImplicantHeap.h.

HeapElement* & Mers::Generators::BFIG::BFIGImplicantHeap::operator[] | ( | unsigned int | elementIndex | ) | `[inline]`

retrieves the element at the specified index and returns it

Parameters:

  | elementIndex | location of the element to be accessed

Returns:
  the element requested if index is in range, otherwise it returns NULL

Reimplemented from Mers::Utils::Containers::DynamicArray.

Definition at line 132 of file BFIGImplicantHeap.h.

HeapElement const* & Mers::Generators::BFIG::BFIGImplicantHeap::operator[] | ( | int | elementIndex | ) | const`[inline]`

retrieves the element at the specified index and returns it

Parameters:

  | elementIndex | location of the element to be accessed

Returns:
  the element requested if index is in range, otherwise it returns NULL

Reimplemented from Mers::Utils::Containers::DynamicArray.

Definition at line 142 of file BFIGImplicantHeap.h.

HeapElement const* & Mers::Generators::BFIG::BFIGImplicantHeap::operator[] | ( | unsigned int | elementIndex | ) | const`[inline]`

retrieves the element at the specified index and returns it

Parameters:

  | elementIndex | location of the element to be accessed

Returns:
  the element requested if index is in range, otherwise it returns NULL

Reimplemented from Mers::Utils::Containers::DynamicArray.

Definition at line 152 of file BFIGImplicantHeap.h.

void BFIGImplicantHeap::printElement | ( | std::ostream & | out,
|  | void const * | element |
| ) |  |  | const`[protected, virtual]`

Prints the element of this array to the std::ostream out. This is called by the DynamicArray::operator<< for each element being printed Derived classes overide this function to provide proper printing of the elements within the array

Parameters:

  | out | the stream being printed to
  | element | the element being printed

Implements Mers::Utils::Containers::DynamicArray.

Definition at line 84 of file BFIGImplicantHeap.cpp.

void BFIGImplicantHeap::deleteElement | ( | void * | element | ) | const`[protected, virtual]`

Called when an element should be deleted because it's storage space is being deleted. This function deletes the element

Parameters:

  | element | the array entry to delete

Implements Mers::Utils::Containers::DynamicArray.

Definition at line 94 of file BFIGImplicantHeap.cpp.

void * BFIGImplicantHeap::newElement | ( | void const * | element | ) | const`[protected, virtual]`

Creates and returns a new array object that is a copy of the element passed in.

Parameters:

  | element | the element being copied

Returns:
  the new array object that is a copy of element

Implements Mers::Utils::Containers::DynamicArray.

Definition at line 101 of file BFIGImplicantHeap.cpp.

bool BFIGImplicantHeap::greaterThan | ( | void const * | e1,
|  | void const * | e2 |
| ) |  |  | const`[protected, virtual]`

returns true if the first element is larger than the second element derived classes should define this for the contents of the heap

Parameters:

  | e1 | the first element being compared to the second element
  | e2 | the second element being compared

Returns:
  valueOf(e1) > valueOf(e2)

Implements Mers::Utils::Containers::DynamicHeap.

Definition at line 108 of file BFIGImplicantHeap.cpp.

bool BFIGImplicantHeap::lessThan | ( | void const * | e1,
|  | void const * | e2 |
| ) |  |  | const`[protected, virtual]`

returns true if the first element is smaller than the second element derived classes should define this for the contents of the heap

Parameters:

  | e1 | the first element being compared to the second element
  | e2 | the second element being compared

Returns:
  valueOf(e1) < valueOf(e2)

Implements Mers::Utils::Containers::DynamicHeap.

Definition at line 118 of file BFIGImplicantHeap.cpp.

## Member Data Documentation

const bool Mers::Generators::BFIG::BFIGImplicantHeap::mPruneByCost`[protected]`

True if we should prune based on the maximum cost. False if we should not prune anything.

Definition at line 210 of file BFIGImplicantHeap.h.

Referenced by insert().

const double Mers::Generators::BFIG::BFIGImplicantHeap::mMaximumCost`[protected]`

This is the maximum cost an implicant can have and still be inserted into this heap.

Definition at line 214 of file BFIGImplicantHeap.h.

Referenced by insert().

The documentation for this class was generated from the following files:

- /Users/fpy/titan-1-5-MBARI/Mers/Generators/BFIG/BFIGImplicantHeap.h
- /Users/fpy/titan-1-5-MBARI/Mers/Generators/BFIG/BFIGImplicantHeap.cpp