OSDImageCache Class Reference

#include <osdimagecache.h>

List of all members.


Detailed Description

Definition at line 41 of file osdimagecache.h.


Public Member Functions

 OSDImageCache ()
 Constructor, initializes the internal cache structures.
virtual ~OSDImageCache ()
 Destructor, frees all cached OSD images.
bool InFileCache (const QString &key) const
bool Contains (const QString &key, bool useFile) const
 Returns true if cached OSD image was found in the cache.
OSDImageCacheValueGet (const QString &key, bool useFile)
 Returns OSD image data from cache.
void Insert (OSDImageCacheValue *value)
 Inserts OSD image data to memory cache.
void SaveToDisk (const OSDImageCacheValue *value)
 Saves OSD image data to disk cache.
void Reset (void)

Static Public Member Functions

static QString CreateKey (const QString &filename, float wmult, float hmult, int scalew, int scaleh)
 Generates a cache key from the given OSD image parameters.
static QString ExtractOriginal (const QString &key)

Private Attributes

QMutex m_cacheLock
img_cache_t m_imageCache
int m_memHits
int m_diskHits
int m_misses

Static Private Attributes

static uint kMaximumMemoryCacheSize = 5 * 1024 * 1024
 Limit on the maximum total size of OSD images cached in *memory*.

Constructor & Destructor Documentation

OSDImageCache::OSDImageCache (  ) 

Constructor, initializes the internal cache structures.

Definition at line 65 of file osdimagecache.cpp.

OSDImageCache::~OSDImageCache (  )  [virtual]

Destructor, frees all cached OSD images.

Definition at line 77 of file osdimagecache.cpp.


Member Function Documentation

bool OSDImageCache::InFileCache ( const QString &  key  )  const

Definition at line 117 of file osdimagecache.cpp.

Referenced by Contains(), Get(), and SaveToDisk().

bool OSDImageCache::Contains ( const QString &  key,
bool  useFile 
) const

Returns true if cached OSD image was found in the cache.

Parameters:
key The key for this image.
useFile If true, also look from the disk cache.

Definition at line 104 of file osdimagecache.cpp.

OSDImageCacheValue * OSDImageCache::Get ( const QString &  key,
bool  useFile 
)

Returns OSD image data from cache.

This also removes the image from the cache so it won't be deleted while in use. The deletion of the taken item becomes responsibility of the client. Returns NULL if item with the given key is not found.

Parameters:
key The key for this image.
useFile If true, also check the disk cache.

Definition at line 157 of file osdimagecache.cpp.

Referenced by OSDTypeImage::Load().

void OSDImageCache::Insert ( OSDImageCacheValue value  ) 

Inserts OSD image data to memory cache.

The item becomes property of the OSDImageCache and may be deleted any time by it.

Parameters:
value The cache item.

Definition at line 218 of file osdimagecache.cpp.

Referenced by OSDTypeImage::Load().

void OSDImageCache::SaveToDisk ( const OSDImageCacheValue value  ) 

Saves OSD image data to disk cache.

Item is not written to the memory cache, i.e., it stays as property of the client.

Parameters:
value The cached OSD image to save.

Definition at line 240 of file osdimagecache.cpp.

Referenced by OSDTypeImage::Load().

void OSDImageCache::Reset ( void   ) 

Definition at line 291 of file osdimagecache.cpp.

Referenced by ~OSDImageCache().

QString OSDImageCache::CreateKey ( const QString &  filename,
float  wmult,
float  hmult,
int  scalew,
int  scaleh 
) [static]

Generates a cache key from the given OSD image parameters.

The returned key is a string that can be safely used as a file name.

Definition at line 275 of file osdimagecache.cpp.

Referenced by OSDTypeImage::Load().

QString OSDImageCache::ExtractOriginal ( const QString &  key  )  [static]

Definition at line 283 of file osdimagecache.cpp.

Referenced by InFileCache().


Member Data Documentation

QMutex OSDImageCache::m_cacheLock [mutable, private]

Definition at line 66 of file osdimagecache.h.

Referenced by Contains(), Get(), Insert(), and Reset().

Definition at line 67 of file osdimagecache.h.

Referenced by Contains(), Get(), Insert(), OSDImageCache(), Reset(), and ~OSDImageCache().

int OSDImageCache::m_memHits [private]

Definition at line 68 of file osdimagecache.h.

Referenced by Get(), and ~OSDImageCache().

Definition at line 69 of file osdimagecache.h.

Referenced by Get(), and ~OSDImageCache().

int OSDImageCache::m_misses [private]

Definition at line 70 of file osdimagecache.h.

Referenced by Get(), and ~OSDImageCache().

uint OSDImageCache::kMaximumMemoryCacheSize = 5 * 1024 * 1024 [static, private]

Limit on the maximum total size of OSD images cached in *memory*.

Definition at line 73 of file osdimagecache.h.


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

Generated on Sat Dec 18 05:16:08 2010 for MythTV by  doxygen 1.5.5