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 (const bool updateUI=true)
 
bool IsLoadInProgress (void) const
 
void WaitForLoadToComplete (void) const
 
void Refresh (void)
 Refreshed the cache. More...
 
void Add (const ProgramInfo &)
 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 &)
 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 (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 (const 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
 
vector< ProgramInfo * > * m_next_cache {nullptr}
 
QObject * m_listener {nullptr}
 
bool m_load_is_queued {false}
 
uint m_loads_in_progress {0}
 
QWaitCondition m_load_wait
 

Friends

class ProgramInfoLoader
 

Detailed Description

Definition at line 21 of file programinfocache.h.

Member Typedef Documentation

◆ Cache

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

Definition at line 55 of file programinfocache.h.

Constructor & Destructor Documentation

◆ ProgramInfoCache()

ProgramInfoCache::ProgramInfoCache ( QObject *  o)
inlineexplicit

Definition at line 25 of file programinfocache.h.

◆ ~ProgramInfoCache()

ProgramInfoCache::~ProgramInfoCache ( )

Definition at line 47 of file programinfocache.cpp.

Member Function Documentation

◆ ScheduleLoad()

void ProgramInfoCache::ScheduleLoad ( const bool  updateUI = true)

◆ IsLoadInProgress()

bool ProgramInfoCache::IsLoadInProgress ( void  ) const

Definition at line 94 of file programinfocache.cpp.

Referenced by PlaybackBox::ScheduleUpdateUIList().

◆ WaitForLoadToComplete()

void ProgramInfoCache::WaitForLoadToComplete ( void  ) const

Definition at line 100 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 117 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 207 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 220 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 156 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 172 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 191 of file programinfocache.cpp.

Referenced by PlaybackBox::HandleUpdateProgramInfoEvent().

◆ GetOrdered()

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

Definition at line 248 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 42 of file programinfocache.h.

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

◆ GetRecordingInfo()

ProgramInfo * ProgramInfoCache::GetRecordingInfo ( uint  recordingID) const

◆ Load()

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

Definition at line 70 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 271 of file programinfocache.cpp.

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

Friends And Related Function Documentation

◆ ProgramInfoLoader

friend class ProgramInfoLoader
friend

Definition at line 23 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_next_cache

vector<ProgramInfo*>* ProgramInfoCache::m_next_cache {nullptr}
private

Definition at line 59 of file programinfocache.h.

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

◆ m_listener

QObject* ProgramInfoCache::m_listener {nullptr}
private

Definition at line 60 of file programinfocache.h.

Referenced by Load().

◆ m_load_is_queued

bool ProgramInfoCache::m_load_is_queued {false}
private

Definition at line 61 of file programinfocache.h.

Referenced by Load(), and ScheduleLoad().

◆ m_loads_in_progress

uint ProgramInfoCache::m_loads_in_progress {0}
private

◆ m_load_wait

QWaitCondition ProgramInfoCache::m_load_wait
mutableprivate

Definition at line 63 of file programinfocache.h.

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


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