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 using event_map_t = QMap<uint, uint64_t>;
20 using key_map_t = QMap<uint, event_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: */
EITCache::m_pruneCnt
uint m_pruneCnt
Definition: eitcache.h:54
EITCache::ClearChannelLocks
static MTV_PUBLIC void ClearChannelLocks(void)
removes old channel locks, use it only at master backend start
Definition: eitcache.cpp:429
EITCache::m_verChgCnt
uint m_verChgCnt
Definition: eitcache.h:51
mythtvexp.h
EITCache::m_channelMap
key_map_t m_channelMap
Definition: eitcache.h:42
EITCache::m_wrongChannelHitCnt
uint m_wrongChannelHitCnt
Definition: eitcache.h:57
EITCache::WriteToDB
void WriteToDB(void)
Definition: eitcache.cpp:300
EITCache::m_hitCnt
uint m_hitCnt
Definition: eitcache.h:49
EITCache::EITCache
EITCache()
Definition: eitcache.cpp:21
EITCache::m_tblChgCnt
uint m_tblChgCnt
Definition: eitcache.h:50
key_map_t
QMap< uint, event_map_t * > key_map_t
Definition: eitcache.h:20
EITCache::GetStatistics
QString GetStatistics(void) const
Definition: eitcache.cpp:46
EITCache::PruneOldEntries
uint PruneOldEntries(uint utc_timestamp)
Prunes entries that describe events ending before timestamp time.
Definition: eitcache.cpp:404
uint
unsigned int uint
Definition: compat.h:141
EITCache::ResetStatistics
void ResetStatistics(void)
Definition: eitcache.cpp:32
EITCache::m_accessCnt
uint m_accessCnt
Definition: eitcache.h:48
EITCache::m_futureHitCnt
uint m_futureHitCnt
Definition: eitcache.h:56
EITCache::m_lastPruneTime
uint m_lastPruneTime
Definition: eitcache.h:45
EITCache::IsNewEIT
bool IsNewEIT(uint chanid, uint tableid, uint version, uint eventid, uint endtime)
Definition: eitcache.cpp:329
EITCache::m_eventMapLock
QMutex m_eventMapLock
Definition: eitcache.h:44
MTV_PUBLIC
#define MTV_PUBLIC
Definition: mythtvexp.h:15
EITCache::WriteChannelToDB
bool WriteChannelToDB(QStringList &value_clauses, uint chanid)
Definition: eitcache.cpp:250
EITCache::kVersionMax
static const uint kVersionMax
Definition: eitcache.h:59
EITCache::m_entryCnt
uint m_entryCnt
Definition: eitcache.h:53
event_map_t
QMap< uint, uint64_t > event_map_t
Definition: eitcache.h:19
EITCache::~EITCache
~EITCache()
Definition: eitcache.cpp:27
EITCache::m_endChgCnt
uint m_endChgCnt
Definition: eitcache.h:52
EITCache::LoadChannel
event_map_t * LoadChannel(uint chanid)
Definition: eitcache.cpp:205
nv_python_libs.bbciplayer.bbciplayer_api.version
string version
Definition: bbciplayer_api.py:81
EITCache
Definition: eitcache.h:23
EITCache::m_prunedHitCnt
uint m_prunedHitCnt
Definition: eitcache.h:55