lab_huffman
Hazardous Huffman Codes
|
Frequency: a plain-old-data type representing a character and its frequency. More...
#include <frequency.h>
Public Member Functions | |
Frequency (char character, int frequency) | |
Constructs a new Frequency object from a given character and its associated frequency in a file. More... | |
Frequency (int frequency) | |
Constructs a new Frequency object from a given frequency count. More... | |
char | getCharacter () const |
Getter for the character for this Frequency object. More... | |
int | getFrequency () const |
Getter for the frequency for this Frequency object. More... | |
bool | operator< (const Frequency &other) const |
Comparison operator for Frequency objects. More... | |
bool | operator== (const Frequency &other) const |
Comparison operator for Frequency objects. More... | |
Private Attributes | |
char | character_ |
int | frequency_ |
Frequency: a plain-old-data type representing a character and its frequency.
Used by the HuffmanTree as the data element of the TreeNodes. If a node is an internal node, the character is the null character ('\0').
Frequency::Frequency | ( | char | character, |
int | frequency | ||
) |
Frequency::Frequency | ( | int | frequency | ) |
Constructs a new Frequency object from a given frequency count.
Frequencies created this way have the null character ('\0') as their character data (these kinds of Frequency objects are used as the data of internal nodes in the HuffmanTree).
frequency | The number to be stored. |
char Frequency::getCharacter | ( | ) | const |
int Frequency::getFrequency | ( | ) | const |
Getter for the frequency for this Frequency object.
bool Frequency::operator< | ( | const Frequency & | other | ) | const |
bool Frequency::operator== | ( | const Frequency & | other | ) | const |