MP5
Image Compression
quadtree_given.h File Reference

Contains functions of the Quadtree class used for grading. More...

+ This graph shows which files directly or indirectly include this file:

Functions

void printTree (std::ostream &out=std::cout) const
 Given: prints the leaves of the Quadtree using a preorder traversal. More...
 
bool operator== (Quadtree const &other) const
 Given: compares the current Quadtree with the parameter Quadtree, and determines whether or not the two are the same. More...
 
void printTree (std::ostream &out, QuadtreeNode const *current, int level) const
 Given: prints the contents of the Quadtree using a preorder traversal. More...
 
bool compareTrees (QuadtreeNode const *firstPtr, QuadtreeNode const *secondPtr) const
 Given: compares the subQuadtree rooted at firstPtr with the subQuadtree rooted at secondPtr, and determines whether the two are the same. More...
 

Detailed Description

Contains functions of the Quadtree class used for grading.

Function Documentation

void printTree ( std::ostream out = std::cout) const

Given: prints the leaves of the Quadtree using a preorder traversal.

bool operator== ( Quadtree const &  other) const

Given: compares the current Quadtree with the parameter Quadtree, and determines whether or not the two are the same.

Parameters
otherReference to a const Quadtree object, against which the current Quadtree will be compared
Returns
True if the Quadtrees are deemed "equal", and false otherwise
Note
This method relies on the private helper method compareTrees()
void printTree ( std::ostream out,
QuadtreeNode const *  current,
int  level 
) const
private

Given: prints the contents of the Quadtree using a preorder traversal.

Parameters
currentPointer to the root of the subQuadtree which we wish to print
levelCurrent recursion depth; used for determining when to terminate recursion (see note below)
bool compareTrees ( QuadtreeNode const *  firstPtr,
QuadtreeNode const *  secondPtr 
) const
private

Given: compares the subQuadtree rooted at firstPtr with the subQuadtree rooted at secondPtr, and determines whether the two are the same.

Parameters
firstPtrPointer to the root of a subtree of the "first" Quadtree under consideration
secondPtrPointer to the root of a subtree of the "second" Quadtree under consideration
Returns
True if the subQuadtrees are deemed "equal", and false otherwise