lab_hash
Hellish Hash Tables
|
LogfileParser class: Provides an interface for querying logfiles of a particular format. More...
#include "logfile_parser.h"
Classes | |
class | LogLine |
LogLine structure: Represents the information contained in a single line of the logfile. More... | |
Public Member Functions | |
LogfileParser (const std::string &fname) | |
Constructs a new LogfileParser from the name of a log file. More... | |
bool | hasVisited (const std::string &customer, const std::string &url) const |
Determines if a given customer has ever visited the given url. More... | |
time_t | dateVisited (const std::string &customer, const std::string &url) const |
Determines when a customer last visited a given url. More... | |
std::vector< std::string > | uniquePages () const |
Gets all of the unique urls that have been visited. More... | |
Private Attributes | |
LPHashTable< std::string, time_t > | whenVisitedTable |
HashTable used to determine when a customer visited a given url. More... | |
std::vector< std::string > | uniqueURLs |
Vector containing the unique urls found in the logfile. More... | |
LogfileParser class: Provides an interface for querying logfiles of a particular format.
LogfileParser::LogfileParser | ( | const std::string & | fname | ) |
Constructs a new LogfileParser from the name of a log file.
fname | The name of the log file to open. |
Given the LogLine above, you should be able to update the member variable hash table and any other hash tables necessary to solve this problem. This should also build the uniqueURLs member vector as well.
bool LogfileParser::hasVisited | ( | const std::string & | customer, |
const std::string & | url | ||
) | const |
Determines if a given customer has ever visited the given url.
customer | The customer name. |
url | The url. |
time_t LogfileParser::dateVisited | ( | const std::string & | customer, |
const std::string & | url | ||
) | const |
Determines when a customer last visited a given url.
If the customer has not visited the given url, the output of this function should be the default time_t.
customer | The customer name. |
url | The url. |
Gets all of the unique urls that have been visited.
|
private |
HashTable used to determine when a customer visited a given url.
Hint: think about what your key should be for this. How could you construct a unique, string key to find information for a given customer and url?
|
private |
Vector containing the unique urls found in the logfile.
You should fill this in the constructor.