TowerOfHanoi
Public Member Functions | Friends | List of all members
Rod Class Reference

Rod is a class to maintains state about disk positions. More...

#include <hanoi.h>

Collaboration diagram for Rod:
Collaboration graph

Public Member Functions

 Rod (std::string name, int capacity)
 Initializes a Rod with a name and a capacity. More...
 
void push (int diskValue)
 
int pop ()
 If the stack is not empty we will pop off the top disk. More...
 
bool isAtCapacity ()
 Checks if we have met the capacity limit. More...
 
bool isEmpty ()
 

Friends

class Hanoi
 

Detailed Description

Rod is a class to maintains state about disk positions.

This class essentially is a wrapper around stack, to enforce a capacity. and enforce inputs. Its use is to maintain state when we are moving disks.

Constructor & Destructor Documentation

◆ Rod()

Rod::Rod ( std::string  name,
int  capacity 
)

Initializes a Rod with a name and a capacity.

Parameters
[in]name- the name of the rod.
[in]capacity- the maximum amount of disks allowed on this rod.

Member Function Documentation

◆ isAtCapacity()

bool Rod::isAtCapacity ( )

Checks if we have met the capacity limit.

Returns
the status of reaching the capacity limit.

◆ isEmpty()

bool Rod::isEmpty ( )

◆ pop()

int Rod::pop ( )

If the stack is not empty we will pop off the top disk.

This function will assert if the stack is empty.

Returns
The disk we are moving off the rod.

◆ push()

void Rod::push ( int  diskValue)

Friends And Related Function Documentation

◆ Hanoi

friend class Hanoi
friend

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