MythTV  0.26-pre
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
ProgramInfoCache Class Reference

#include <programinfocache.h>

List of all members.

Classes

struct  ltkey
class  PICKey

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.
void Add (const ProgramInfo &)
 Adds a ProgramInfo to the cache.
bool Remove (uint chanid, const QDateTime &recstartts)
 Marks a ProgramInfo in the cache for deletion on the next call to Refresh().
bool Update (const ProgramInfo &)
 Updates a ProgramInfo in the cache.
bool UpdateFileSize (uint chanid, const QDateTime &recstartts, uint64_t filesize)
 Updates a ProgramInfo in the cache.
QString GetRecGroup (uint chanid, const QDateTime &recstartts) const
 Returns the ProgramInfo::recgroup or an empty string if not found.
void GetOrdered (vector< ProgramInfo * > &list, bool newest_first=false)
bool empty (void) const
ProgramInfoGetProgramInfo (uint chanid, const QDateTime &recstartts) const
ProgramInfoGetProgramInfo (const QString &piKey) const

Private Types

typedef map< PICKey,
ProgramInfo *, ltkey
Cache

Private Member Functions

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

Private Attributes

QMutex m_lock
Cache m_cache
vector< ProgramInfo * > * m_next_cache
QObject * m_listener
bool m_load_is_queued
uint m_loads_in_progress
QWaitCondition m_load_wait

Friends

class ProgramInfoLoader

Detailed Description

Definition at line 23 of file programinfocache.h.


Member Typedef Documentation

Definition at line 71 of file programinfocache.h.


Constructor & Destructor Documentation

Definition at line 45 of file programinfocache.cpp.

Definition at line 51 of file programinfocache.cpp.


Member Function Documentation

Definition at line 98 of file programinfocache.cpp.

Referenced by PlaybackBox::ScheduleUpdateUIList().

Definition at line 104 of file programinfocache.cpp.

Referenced by PlaybackBox::Load().

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 121 of file programinfocache.cpp.

Referenced by PlaybackBox::UpdateUILists().

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 215 of file programinfocache.cpp.

Referenced by PlaybackBox::HandleRecordingAddEvent().

bool ProgramInfoCache::Remove ( uint  chanid,
const QDateTime &  recstartts 
)

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 229 of file programinfocache.cpp.

Referenced by PlaybackBox::HandleRecordingRemoveEvent().

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 161 of file programinfocache.cpp.

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

bool ProgramInfoCache::UpdateFileSize ( uint  chanid,
const QDateTime &  recstartts,
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 178 of file programinfocache.cpp.

Referenced by PlaybackBox::HandleUpdateProgramInfoFileSizeEvent().

QString ProgramInfoCache::GetRecGroup ( uint  chanid,
const QDateTime &  recstartts 
) 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 198 of file programinfocache.cpp.

Referenced by PlaybackBox::HandleUpdateProgramInfoEvent().

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

Definition at line 239 of file programinfocache.cpp.

Referenced by PlaybackBox::UpdateUILists().

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

Definition at line 44 of file programinfocache.h.

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

ProgramInfo * ProgramInfoCache::GetProgramInfo ( uint  chanid,
const QDateTime &  recstartts 
) const
ProgramInfo * ProgramInfoCache::GetProgramInfo ( const QString &  piKey) const

Definition at line 265 of file programinfocache.cpp.

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

Definition at line 74 of file programinfocache.cpp.

Referenced by ProgramInfoLoader::run().

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

Definition at line 275 of file programinfocache.cpp.

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


Friends And Related Function Documentation

friend class ProgramInfoLoader [friend]

Definition at line 25 of file programinfocache.h.

Referenced by ScheduleLoad().


Member Data Documentation

QMutex ProgramInfoCache::m_lock [mutable, private]

Definition at line 75 of file programinfocache.h.

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

QObject* ProgramInfoCache::m_listener [private]

Definition at line 76 of file programinfocache.h.

Referenced by Load().

Definition at line 77 of file programinfocache.h.

Referenced by Load(), and ScheduleLoad().

QWaitCondition ProgramInfoCache::m_load_wait [mutable, private]

Definition at line 79 of file programinfocache.h.

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


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends