MythTV  master
eitcache.h
Go to the documentation of this file.
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 <cstdint>
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  bool WriteChannelToDB(QStringList &value_clauses, uint chanid);
40 
41  // event key cache
43 
44  mutable QMutex m_eventMapLock;
46 
47  // statistics
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: */
QMap< uint, uint64_t > event_map_t
Definition: eitcache.h:19
uint m_pruneCnt
Definition: eitcache.h:54
static MTV_PUBLIC void ClearChannelLocks(void)
removes old channel locks, use it only at master b<ackend start
Definition: eitcache.cpp:443
uint m_prunedHitCnt
Definition: eitcache.h:55
uint m_verChgCnt
Definition: eitcache.h:51
key_map_t m_channelMap
Definition: eitcache.h:42
unsigned int uint
Definition: compat.h:140
uint m_tblChgCnt
Definition: eitcache.h:50
uint m_hitCnt
Definition: eitcache.h:49
uint m_wrongChannelHitCnt
Definition: eitcache.h:57
void ResetStatistics(void)
Definition: eitcache.cpp:36
uint m_futureHitCnt
Definition: eitcache.h:56
uint m_lastPruneTime
Definition: eitcache.h:45
#define MTV_PUBLIC
Definition: mythtvexp.h:15
QMap< uint, event_map_t * > key_map_t
Definition: eitcache.h:20
void WriteToDB(void)
Definition: eitcache.cpp:308
EITCache()
Definition: eitcache.cpp:21
QString GetStatistics(void) const
Definition: eitcache.cpp:50
uint PruneOldEntries(uint utc_timestamp)
Prunes entries that describe events ending before timestamp time.
Definition: eitcache.cpp:414
QMutex m_eventMapLock
Definition: eitcache.h:44
bool WriteChannelToDB(QStringList &value_clauses, uint chanid)
Definition: eitcache.cpp:262
static const uint kVersionMax
Definition: eitcache.h:59
bool IsNewEIT(uint chanid, uint tableid, uint version, uint eventid, uint endtime)
Definition: eitcache.cpp:337
uint m_endChgCnt
Definition: eitcache.h:52
uint m_entryCnt
Definition: eitcache.h:53
uint m_accessCnt
Definition: eitcache.h:48
~EITCache()
Definition: eitcache.cpp:31
event_map_t * LoadChannel(uint chanid)
Definition: eitcache.cpp:217