MythTV  master
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
ProgramInfoCache Class Reference

#include <programinfocache.h>

Collaboration diagram for ProgramInfoCache:
Collaboration graph
[legend]

Public Member Functions

 ProgramInfoCache (QObject *o)
 
 ~ProgramInfoCache ()
 
void ScheduleLoad (bool updateUI=true)
 
bool IsLoadInProgress (void) const
 
void WaitForLoadToComplete (void) const
 
void Refresh (void)
 Refreshed the cache. More...
 
void Add (const ProgramInfo &pginfo)
 Adds a ProgramInfo to the cache. More...
 
bool Remove (uint recordingID)
 Marks a ProgramInfo in the cache for deletion on the next call to Refresh(). More...
 
bool Update (const ProgramInfo &pginfo)
 Updates a ProgramInfo in the cache. More...
 
bool UpdateFileSize (uint recordingID, uint64_t filesize)
 Updates a ProgramInfo in the cache. More...
 
QString GetRecGroup (uint recordingID) const
 Returns the ProgramInfo::recgroup or an empty string if not found. More...
 
void GetOrdered (std::vector< ProgramInfo * > &list, bool newest_first=false)
 
bool empty (void) const
 
ProgramInfoGetRecordingInfo (uint recordingID) const
 

Private Types

using Cache = QHash< uint, ProgramInfo * >
 

Private Member Functions

void Load (bool updateUI=true)
 
void Clear (void)
 Clears the cache, m_lock must be held when this is called. More...
 

Private Attributes

QMutex m_lock
 
Cache m_cache
 
std::vector< ProgramInfo * > * m_nextCache {nullptr}
 
QObject * m_listener {nullptr}
 
bool m_loadIsQueued {false}
 
uint m_loadsInProgress {0}
 
QWaitCondition m_loadWait
 

Friends

class ProgramInfoLoader
 

Detailed Description

Definition at line 20 of file programinfocache.h.

Member Typedef Documentation

◆ Cache

using ProgramInfoCache::Cache = QHash<uint,ProgramInfo*>
private

Definition at line 54 of file programinfocache.h.

Constructor & Destructor Documentation

◆ ProgramInfoCache()

ProgramInfoCache::ProgramInfoCache ( QObject *  o)
inlineexplicit

Definition at line 24 of file programinfocache.h.

◆ ~ProgramInfoCache()

ProgramInfoCache::~ProgramInfoCache ( )

Definition at line 46 of file programinfocache.cpp.

Member Function Documentation

◆ ScheduleLoad()

void ProgramInfoCache::ScheduleLoad ( bool  updateUI = true)

◆ IsLoadInProgress()

bool ProgramInfoCache::IsLoadInProgress ( void  ) const

Definition at line 93 of file programinfocache.cpp.

Referenced by PlaybackBox::ScheduleUpdateUIList().

◆ WaitForLoadToComplete()

void ProgramInfoCache::WaitForLoadToComplete ( void  ) const

Definition at line 99 of file programinfocache.cpp.

Referenced by PlaybackBox::Load().

◆ Refresh()

void ProgramInfoCache::Refresh ( void  )

Refreshed the cache.

If a new list has been loaded this fills the cache with that list if not, this simply removes list items marked for deletion from the the list.

Note
This must only be called from the UI thread.
All references to the ProgramInfo pointers should be cleared before this is called.

Definition at line 116 of file programinfocache.cpp.

Referenced by PlaybackBox::UpdateUILists().

◆ Add()

void ProgramInfoCache::Add ( const ProgramInfo pginfo)

Adds a ProgramInfo to the cache.

Note
This must only be called from the UI thread.

Definition at line 203 of file programinfocache.cpp.

Referenced by PlaybackBox::HandleRecordingAddEvent().

◆ Remove()

bool ProgramInfoCache::Remove ( uint  recordingID)

Marks a ProgramInfo in the cache for deletion on the next call to Refresh().

Note
This must only be called from the UI thread.
Returns
True iff the ProgramInfo was in the cache.

Definition at line 216 of file programinfocache.cpp.

Referenced by PlaybackBox::HandleRecordingRemoveEvent().

◆ Update()

bool ProgramInfoCache::Update ( const ProgramInfo pginfo)

Updates a ProgramInfo in the cache.

Note
This must only be called from the UI thread.
Returns
True iff the ProgramInfo was in the cache and was updated.

Definition at line 152 of file programinfocache.cpp.

Referenced by Add(), and PlaybackBox::HandleUpdateProgramInfoEvent().

◆ UpdateFileSize()

bool ProgramInfoCache::UpdateFileSize ( uint  recordingID,
uint64_t  filesize 
)

Updates a ProgramInfo in the cache.

Note
This must only be called from the UI thread.
Returns
True iff the ProgramInfo was in the cache and was updated.

Definition at line 168 of file programinfocache.cpp.

Referenced by PlaybackBox::HandleUpdateProgramInfoFileSizeEvent().

◆ GetRecGroup()

QString ProgramInfoCache::GetRecGroup ( uint  recordingID) const

Returns the ProgramInfo::recgroup or an empty string if not found.

Note
This must only be called from the UI thread.

Definition at line 187 of file programinfocache.cpp.

Referenced by PlaybackBox::HandleUpdateProgramInfoEvent().

◆ GetOrdered()

void ProgramInfoCache::GetOrdered ( std::vector< ProgramInfo * > &  list,
bool  newest_first = false 
)

Definition at line 244 of file programinfocache.cpp.

Referenced by PlaybackBox::UpdateUILists().

◆ empty()

bool ProgramInfoCache::empty ( void  ) const
inline
Note
This must only be called from the UI thread.

Definition at line 41 of file programinfocache.h.

Referenced by PlaybackBox::updateRecList(), and PlaybackBox::UpdateUILists().

◆ GetRecordingInfo()

ProgramInfo * ProgramInfoCache::GetRecordingInfo ( uint  recordingID) const

◆ Load()

void ProgramInfoCache::Load ( bool  updateUI = true)
private

Definition at line 69 of file programinfocache.cpp.

Referenced by ProgramInfoLoader::run().

◆ Clear()

void ProgramInfoCache::Clear ( void  )
private

Clears the cache, m_lock must be held when this is called.

Definition at line 266 of file programinfocache.cpp.

Referenced by Refresh(), and ~ProgramInfoCache().

Friends And Related Function Documentation

◆ ProgramInfoLoader

friend class ProgramInfoLoader
friend

Definition at line 22 of file programinfocache.h.

Referenced by ScheduleLoad().

Member Data Documentation

◆ m_lock

QMutex ProgramInfoCache::m_lock
mutableprivate

◆ m_cache

Cache ProgramInfoCache::m_cache
private

◆ m_nextCache

std::vector<ProgramInfo*>* ProgramInfoCache::m_nextCache {nullptr}
private

Definition at line 58 of file programinfocache.h.

Referenced by Load(), Refresh(), and ~ProgramInfoCache().

◆ m_listener

QObject* ProgramInfoCache::m_listener {nullptr}
private

Definition at line 59 of file programinfocache.h.

Referenced by Load().

◆ m_loadIsQueued

bool ProgramInfoCache::m_loadIsQueued {false}
private

Definition at line 60 of file programinfocache.h.

Referenced by Load(), and ScheduleLoad().

◆ m_loadsInProgress

uint ProgramInfoCache::m_loadsInProgress {0}
private

◆ m_loadWait

QWaitCondition ProgramInfoCache::m_loadWait
mutableprivate

Definition at line 62 of file programinfocache.h.

Referenced by Load(), WaitForLoadToComplete(), and ~ProgramInfoCache().


The documentation for this class was generated from the following files: