00001 #ifndef STATS_H 00002 #define STATS_H 00003 // $Id: stats.h,v 1.2 2001/04/12 15:26:19 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 /* Selected logrecords can be added using Stats::add, the contents 00014 of the database can be printed using operator<<(ostream&,const Stats&). 00015 */ 00016 class Stats { 00017 public: 00019 00022 Stats(const Configuration&); 00024 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 00038 friend ostream& 00039 operator<<(ostream&,const Stats&); 00040 private: 00042 00045 typedef map<DatePattern,unsigned int> DateCount; 00047 00050 typedef map<Path,unsigned int> PathCount; 00052 00056 typedef map<Domain,unsigned int> DomainCount; 00057 00058 DateCount dates_; 00059 PathCount paths_; 00060 DomainCount domains_; 00062 Configuration configuration_; 00063 }; 00064 #endif