lab_huffman
Hazardous Huffman Codes
|
encoder namespace: collection of functions used for running the encoder program. More...
Functions | |
int | main (const std::vector< std::string > &args) |
Main method of the program, should you choose to run it as a command line version. More... | |
void | printUsage (const std::string &programName) |
Prints the usage of the command line version. More... | |
void | encodeFile (const std::string &inputName, const std::string &outputName, const std::string &treeName) |
Encodes a file using Huffman coding. More... | |
std::vector< Frequency > | getFrequencies (const std::string &str) |
Determines the frequencies of characters in a string. More... | |
encoder namespace: collection of functions used for running the encoder program.
int encoder::main | ( | const std::vector< std::string > & | args | ) |
Main method of the program, should you choose to run it as a command line version.
args | The command line arguments, with args[0] being the program name. |
void encoder::printUsage | ( | const std::string & | programName | ) |
Prints the usage of the command line version.
programName | The name of the program. |
void encoder::encodeFile | ( | const std::string & | inputName, |
const std::string & | outputName, | ||
const std::string & | treeName | ||
) |
Encodes a file using Huffman coding.
Also creates the compressed output of the HuffmanTree so it can be read in and used for decompression.
inputName | Name of the file to be compressed. |
outputName | Name of the file to write compressed output. |
treeName | Name of the file to write the compressed HuffmanTree. |
vector< Frequency > encoder::getFrequencies | ( | const std::string & | str | ) |
Determines the frequencies of characters in a string.
str | The string to be searched. |