MythTV  master
programinfoupdater.h
Go to the documentation of this file.
1 #ifndef PROGRAM_INFO_UPDATER_H
2 #define PROGRAM_INFO_UPDATER_H
3 
4 // C++ headers
5 #include <cstdint> // for [u]int[32,64]_t
6 #include <vector>
7 
8 // Qt headers
9 #include <QWaitCondition>
10 #include <QDateTime>
11 #include <QRunnable>
12 #include <QMutex>
13 #include <QHash>
14 
15 // Myth
16 #include "mythexp.h"
17 
18 enum PIAction {
23 };
24 
26 {
27  public:
28  PIKeyAction(uint recordedid, PIAction a) :
29  m_recordedid(recordedid), m_action(a) { }
30 
33 
34  bool operator==(const PIKeyAction &other) const
35  {
36  return (m_recordedid == other.m_recordedid);
37  }
38 };
39 
41 {
42  public:
43  PIKeyData(PIAction a, uint64_t f) : m_action(a), m_filesize(f) { }
45  uint64_t m_filesize;
46 };
47 
48 class MPUBLIC ProgramInfoUpdater : public QRunnable
49 {
50  public:
51  ProgramInfoUpdater() { setAutoDelete(false); }
52 
53  void insert(uint recordedid,
54  PIAction action, uint64_t filesize = 0ULL);
55  void run(void) override; // QRunnable
56 
57  private:
58  QMutex m_lock;
59  QWaitCondition m_moreWork;
60  bool m_isRunning {false};
61  std::vector<PIKeyAction> m_needsAddDelete;
62  QHash<uint,PIKeyData> m_needsUpdate;
63 };
64 
65 #endif // PROGRAM_INFO_UPDATER_H
PIKeyData::m_action
PIAction m_action
Definition: programinfoupdater.h:44
PIKeyData
Definition: programinfoupdater.h:40
MPUBLIC
#define MPUBLIC
Definition: mythexp.h:10
mythexp.h
PIKeyAction::operator==
bool operator==(const PIKeyAction &other) const
Definition: programinfoupdater.h:34
kPIDelete
@ kPIDelete
Definition: programinfoupdater.h:20
kPIAdd
@ kPIAdd
Definition: programinfoupdater.h:19
PIKeyData::PIKeyData
PIKeyData(PIAction a, uint64_t f)
Definition: programinfoupdater.h:43
ProgramInfoUpdater::m_moreWork
QWaitCondition m_moreWork
Definition: programinfoupdater.h:59
PIKeyAction
Definition: programinfoupdater.h:25
ProgramInfoUpdater::m_lock
QMutex m_lock
Definition: programinfoupdater.h:58
ProgramInfoUpdater::m_needsUpdate
QHash< uint, PIKeyData > m_needsUpdate
Definition: programinfoupdater.h:62
PIAction
PIAction
Definition: programinfoupdater.h:18
ProgramInfoUpdater
Definition: programinfoupdater.h:48
PIKeyAction::PIKeyAction
PIKeyAction(uint recordedid, PIAction a)
Definition: programinfoupdater.h:28
ProgramInfoUpdater::m_needsAddDelete
std::vector< PIKeyAction > m_needsAddDelete
Definition: programinfoupdater.h:61
f
QTextStream t & f
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:600
uint
unsigned int uint
Definition: compat.h:140
kPIUpdateFileSize
@ kPIUpdateFileSize
Definition: programinfoupdater.h:22
PIKeyData::m_filesize
uint64_t m_filesize
Definition: programinfoupdater.h:45
PIKeyAction::m_action
PIAction m_action
Definition: programinfoupdater.h:32
build_compdb.action
action
Definition: build_compdb.py:9
kPIUpdate
@ kPIUpdate
Definition: programinfoupdater.h:21
ProgramInfoUpdater::ProgramInfoUpdater
ProgramInfoUpdater()
Definition: programinfoupdater.h:51
PIKeyAction::m_recordedid
uint m_recordedid
Definition: programinfoupdater.h:31