00001 #ifndef STATS_H 00002 #define STATS_H 00003 // $Id: stats_h-source.html,v 1.1 2001/04/16 17:43:03 dvermeir Exp $ 00004 #include <map> 00005 #include <vector> 00006 #include "configuration.h" 00007 #include "logrecord.h" 00008 #include "domain.h" 00009 #include "path.h" 00010 #include "datepattern.h" 00011 00013 00016 class Stats { 00017 public: 00019 00022 Stats(const Configuration&); 00024 /* The decision on which map to add to depends on configuration_. 00025 */ 00026 void add(const LogRecord&); 00027 00029 void print_dates(ostream&) const; 00031 void print_paths(ostream&) const; 00033 void print_domains(ostream&) const; 00034 00036 /* What informatin (dates, paths or domains) depends on configuration_. 00037 */ 00038 friend ostream& 00039 operator<<(ostream&,const Stats&); 00040 private: 00042 00045 typedef map<DatePattern,unsigned int> DateCount; 00046 // The key of a PathCount map is a path category vector, e.g. 00050 typedef map<Path,unsigned int> PathCount; 00051 // The key of a DomainCount map is a domain category vector, e.g. 00056 typedef map<Domain,unsigned int> DomainCount; 00057 00058 DateCount dates_; 00059 PathCount paths_; 00060 DomainCount domains_; 00062 Configuration configuration_; 00063 }; 00064 #endif