| 1 | /* -*- Mode: c++ -*-
|
|---|
| 2 | * Copyright 2006 (C) Stuart Auchterlonie <stuarta at squashedfrog.net>
|
|---|
| 3 | * License: GPL v2
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | #ifndef _EIT_CACHE_H
|
|---|
| 7 | #define _EIT_CACHE_H
|
|---|
| 8 |
|
|---|
| 9 | #include <stdint.h>
|
|---|
| 10 |
|
|---|
| 11 | // Qt headers
|
|---|
| 12 | #include <QString>
|
|---|
| 13 | #include <QMutex>
|
|---|
| 14 | #include <QMap>
|
|---|
| 15 |
|
|---|
| 16 | // MythTV headers
|
|---|
| 17 | #include "mythtvexp.h"
|
|---|
| 18 |
|
|---|
| 19 | typedef QMap<uint, uint64_t> event_map_t;
|
|---|
| 20 | typedef QMap<uint, event_map_t*> key_map_t;
|
|---|
| 21 |
|
|---|
| 22 | class EITCache
|
|---|
| 23 | {
|
|---|
| 24 | public:
|
|---|
| 25 | EITCache();
|
|---|
| 26 | ~EITCache();
|
|---|
| 27 |
|
|---|
| 28 | bool IsNewEIT(uint chanid, uint tableid, uint version,
|
|---|
| 29 | uint eventid, uint endtime);
|
|---|
| 30 |
|
|---|
| 31 | uint PruneOldEntries(uint utc_timestamp);
|
|---|
| 32 | void WriteToDB(void);
|
|---|
| 33 |
|
|---|
| 34 | void ResetStatistics(void);
|
|---|
| 35 | QString GetStatistics(void) const;
|
|---|
| 36 |
|
|---|
| 37 | private:
|
|---|
| 38 | event_map_t * LoadChannel(uint chanid);
|
|---|
| 39 | void WriteChannelToDB(uint chanid);
|
|---|
| 40 |
|
|---|
| 41 | // event key cache
|
|---|
| 42 | key_map_t channelMap;
|
|---|
| 43 |
|
|---|
| 44 | mutable QMutex eventMapLock;
|
|---|
| 45 | uint lastPruneTime;
|
|---|
| 46 |
|
|---|
| 47 | // statistics
|
|---|
| 48 | uint accessCnt;
|
|---|
| 49 | uint hitCnt;
|
|---|
| 50 | uint tblChgCnt;
|
|---|
| 51 | uint verChgCnt;
|
|---|
| 52 | uint endChgCnt;
|
|---|
| 53 | uint entryCnt;
|
|---|
| 54 | uint pruneCnt;
|
|---|
| 55 | uint prunedHitCnt;
|
|---|
| 56 | uint futureHitCnt;
|
|---|
| 57 | uint wrongChannelHitCnt;
|
|---|
| 58 |
|
|---|
| 59 | static const uint kVersionMax;
|
|---|
| 60 |
|
|---|
| 61 | public:
|
|---|
| 62 | static MTV_PUBLIC void ClearChannelLocks(void);
|
|---|
| 63 | };
|
|---|
| 64 |
|
|---|
| 65 | #endif // _EIT_CACHE_H
|
|---|
| 66 |
|
|---|
| 67 | /* vim: set expandtab tabstop=4 shiftwidth=4: */
|
|---|