the first part of reimplementing has been done

now we have app object and singletons are only: log logn plugin and app



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@628 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-08-10 16:12:50 +00:00
parent 6897192364
commit 217cf1420b
191 changed files with 9529 additions and 7250 deletions

View File

@@ -11,50 +11,79 @@
#define headerfilecmsluplugin_stats_stats
#include <string>
#include <map>
#include <fstream>
#include "core/config.h"
namespace Stats
{
struct StatsGlobal
{
int all;
int unique;
int google;
int yahoo;
StatsGlobal()
{
all = 0;
unique = 0;
google = 0;
yahoo = 0;
}
};
struct Stats
{
int all;
int google;
int yahoo;
Stats();
Stats()
void ReadStats();
void SaveStats();
void PeriodicSave();
void ReadConfig(Config * config);
void RemoveItem(long id);
// file name for reading/saving statistics
std::string stats_file;
// when the statistics start
time_t stats_start;
int global_all;
int global_unique;
int global_google;
int global_yahoo;
// statistics for files/dirs
struct ItemStats
{
all = 0;
google = 0;
yahoo = 0;
}
int all;
int google;
int yahoo;
ItemStats()
{
all = 0;
google = 0;
yahoo = 0;
}
};
// <item_id, Item_stats>
typedef std::map<long, ItemStats> StatsTab;
StatsTab stats_tab;
private:
// when to save the config (how many requests should have gone)
// (for safety: power failure etc)
// default: 1000
// you can set: stats_req_save_freq in the config file to overwrite it
// 0 - turn it off
int req_save_freq;
int req_current; // helper
void ReadStats(std::ifstream & file);
void SaveStats(std::ofstream & file);
};
extern std::string stats_file;
void ReadStats();
void SaveStats();
} // namespace
#endif