lab_hash
Hellish Hash Tables
|
CharFreq class: a class that allows for counting the frequency with which characters appear in a file. More...
#include "char_counter.h"
Public Member Functions | |
CharFreq (const std::string &ifilename) | |
Constructs a CharFreq object based on the name of a file. More... | |
std::vector< std::pair< char, int > > | getChars (int threshold) |
Returns a vector of pairs, where the first element is the character and the second element is the frequency with which the character appeared in the file for the CharFreq object. More... | |
Private Attributes | |
std::string | filename |
The name of the file to read from. More... | |
CharFreq class: a class that allows for counting the frequency with which characters appear in a file.
CharFreq< Dict >::CharFreq | ( | const std::string & | ifilename | ) |
Constructs a CharFreq object based on the name of a file.
ifilename | Input file to read characters from. |
vector< pair< char, int > > CharFreq< Dict >::getChars | ( | int | threshold | ) |
Returns a vector of pairs, where the first element is the character and the second element is the frequency with which the character appeared in the file for the CharFreq object.
Only characters with frequency greater than or equal to the threshold are placed in the vector.
threshold | The threshold at which a character, frequency pair is added to the vector. |
|
private |
The name of the file to read from.