lab_huffman
Hazardous Huffman Codes
encoder Namespace Reference

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< FrequencygetFrequencies (const std::string &str)
 Determines the frequencies of characters in a string. More...
 

Detailed Description

encoder namespace: collection of functions used for running the encoder program.

Function Documentation

◆ encodeFile()

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.

Parameters
inputNameName of the file to be compressed.
outputNameName of the file to write compressed output.
treeNameName of the file to write the compressed HuffmanTree.

◆ getFrequencies()

vector< Frequency > encoder::getFrequencies ( const std::string str)

Determines the frequencies of characters in a string.

Parameters
strThe string to be searched.
Returns
A vector of Frequency objects representing the frequency each character in the file has.

◆ main()

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.

Parameters
argsThe command line arguments, with args[0] being the program name.

◆ printUsage()

void encoder::printUsage ( const std::string programName)

Prints the usage of the command line version.

Parameters
programNameThe name of the program.