00001 /* -*- Mode: c++ -*- 00002 * Copyright 2006 (C) Stuart Auchterlonie <stuarta at squashedfrog.net> 00003 * License: GPL v2 00004 */ 00005 00006 #ifndef _EIT_CACHE_H 00007 #define _EIT_CACHE_H 00008 00009 #include <stdint.h> 00010 00011 // Qt headers 00012 #include <QString> 00013 #include <QMutex> 00014 #include <QMap> 00015 00016 // MythTV headers 00017 #include "mythtvexp.h" 00018 00019 typedef QMap<uint, uint64_t> event_map_t; 00020 typedef QMap<uint, event_map_t*> key_map_t; 00021 00022 class EITCache 00023 { 00024 public: 00025 EITCache(); 00026 ~EITCache(); 00027 00028 bool IsNewEIT(uint chanid, uint tableid, uint version, 00029 uint eventid, uint endtime); 00030 00031 uint PruneOldEntries(uint utc_timestamp); 00032 void WriteToDB(void); 00033 00034 void ResetStatistics(void); 00035 QString GetStatistics(void) const; 00036 00037 private: 00038 event_map_t * LoadChannel(uint chanid); 00039 void WriteChannelToDB(uint chanid); 00040 00041 // event key cache 00042 key_map_t channelMap; 00043 00044 mutable QMutex eventMapLock; 00045 uint lastPruneTime; 00046 00047 // statistics 00048 uint accessCnt; 00049 uint hitCnt; 00050 uint tblChgCnt; 00051 uint verChgCnt; 00052 uint entryCnt; 00053 uint pruneCnt; 00054 uint prunedHitCnt; 00055 uint wrongChannelHitCnt; 00056 00057 static const uint kVersionMax; 00058 00059 public: 00060 static MTV_PUBLIC void ClearChannelLocks(void); 00061 }; 00062 00063 #endif // _EIT_CACHE_H 00064 00065 /* vim: set expandtab tabstop=4 shiftwidth=4: */
1.6.3