lab_hash
Hellish Hash Tables
CharFreq< Dict > Class Template Reference

CharFreq class: a class that allows for counting the frequency with which characters appear in a file. More...

#include "char_counter.h"

+ Collaboration diagram for CharFreq< Dict >:

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...
 

Detailed Description

template<template< class K, class V > class Dict>
class CharFreq< Dict >

CharFreq class: a class that allows for counting the frequency with which characters appear in a file.

Author
Chase Geigle
Date
Spring 2011
Summer 2012

Constructor & Destructor Documentation

◆ CharFreq()

template<template< class K, class V > class Dict>
CharFreq< Dict >::CharFreq ( const std::string ifilename)

Constructs a CharFreq object based on the name of a file.

Parameters
ifilenameInput file to read characters from.

Member Function Documentation

◆ getChars()

template<template< class K, class V > class Dict>
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.

Parameters
thresholdThe threshold at which a character, frequency pair is added to the vector.
Returns
A vector of pairs of characters and frequencies.

Member Data Documentation

◆ filename

template<template< class K, class V > class Dict>
std::string CharFreq< Dict >::filename
private

The name of the file to read from.


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