Implementation of Cache for Guiliani image resources. More...
#include <GUIImageCacheImpl.h>
Public Member Functions | |
eC_UInt | GetCurrentMemoryUsage () const |
eC_UInt | GetFreeListSize () const |
eC_UInt | GetImageSize (const ImageResource_t &eImageID) const |
eC_UInt | GetUsedListSize () const |
eC_Bool | ReadCacheSettingsFromFile (const eC_String &rkPath) |
![]() | |
eC_UInt | GetCacheSizeLimit () const |
virtual eC_UInt | GetCurrentMemoryUsage () const =0 |
virtual eC_UInt | GetImageSize (const ImageResource_t &eImageID) const =0 |
virtual eC_Bool | ReadCacheSettingsFromFile (const eC_String &kPath)=0 |
eC_Bool | SetCacheSizeLimit (eC_UInt uiCacheSizeLimit) |
virtual void | SetFreeReplacementPolicy (CGUIImageCacheReplacementPolicy *pPolicy) |
void | SetReadResolutionAppendix (const eC_String &kAppendString) |
virtual void | SetUsedReplacementPolicy (CGUIImageCacheReplacementPolicy *pPolicy) |
Protected Member Functions | |
CGUIImageCacheImpl (eC_UInt uiCacheSizeLimit, ReplacementPolicyType_t eUsed, ReplacementPolicyType_t eFree) | |
~CGUIImageCacheImpl () | |
Destructor. | |
void | CopyCacheContents (CGUIImageCacheReplacementPolicy *pOldPolicy, CGUIImageCacheReplacementPolicy *pNewPolicy) |
eC_Bool | FreeSpace (eC_UInt uiSpaceToFree) |
eC_Bool | LoadImg (const eC_String &psPath, const ImageResource_t &eImageID) |
void | MarkAsFree (const ImageResource_t &eImageID) |
void | MarkAsUsed (const ImageResource_t &eImageID) |
void | NotifyImageAccessInternal (const ImageResource_t &eImageID) |
eC_Bool | PreloadImg (const eC_String &psPath, const ImageResource_t &eImageID) |
eC_Bool | UnloadSpecificImage (const ImageResource_t &eImageID) |
![]() | |
virtual | ~CGUIImageCache () |
Destructor. | |
virtual void | CopyCacheContents (CGUIImageCacheReplacementPolicy *pOldPolicy, CGUIImageCacheReplacementPolicy *pNewPolicy)=0 |
virtual eC_Bool | FreeSpace (eC_UInt uiSpaceToFree)=0 |
virtual eC_Bool | LoadImg (const eC_String &kPath, const ImageResource_t &eImageID)=0 |
virtual void | MarkAsFree (const ImageResource_t &eImageID)=0 |
virtual void | MarkAsUsed (const ImageResource_t &eImageID)=0 |
virtual void | NotifyImageAccessInternal (const ImageResource_t &eImageID)=0 |
virtual eC_Bool | PreloadImg (const eC_String &psPath, const ImageResource_t &eImageID)=0 |
virtual eC_Bool | UnloadSpecificImage (const ImageResource_t &eImageID)=0 |
Friends | |
class | CGUIImageCache |
Additional Inherited Members | |
![]() | |
static void | CreateInstance (eC_UInt uiSize=100 *1024 *1024, ReplacementPolicyType_t eUsed=IC_REPLACEMENT_POLICY_LRU, ReplacementPolicyType_t eFree=IC_REPLACEMENT_POLICY_LRU) |
static void | DeleteInstance () |
Deletes the only instance of this class. | |
static CGUIImageCache * | GetInstance () |
![]() | |
static void | NotifyImageAccess (const ImageResource_t &eImageID) |
![]() | |
eC_String | m_kAppendString |
Extension to the resolution for config reading. | |
CGUIImageCacheReplacementManager * | m_pFreeListManager |
Pointer to the current free list manager. | |
CGUIImageCacheReplacementPolicy * | m_pFreeReplacementPolicy |
Pointer to the current free list replacement policy. | |
CGUIImageCacheReplacementManager * | m_pUsedListManager |
Pointer to the current used list manager. | |
CGUIImageCacheReplacementPolicy * | m_pUsedReplacementPolicy |
Pointer to the current used list replacement policy. | |
eC_UInt | m_uiCacheSizeLimit |
Maximum amount of memory used by images. | |
![]() | |
static CGUIImageCache * | ms_pInstance |
Pointer to singleton instance. | |
Implementation of Cache for Guiliani image resources.
|
protected |
Constructor.
uiCacheSizeLimit | The maximum amount of memory that can be used by images. |
eUsed | Policy for used images |
eFree | Policy for free images |
|
protectedvirtual |
Copies the cache contents of one replacement policy to the other. This is needed for changing replacement policies at runtime. Used as a hook in the template methods SetFreeReplacgementPolicy and SetUsedReplacementPolicy.
pOldPolicy | old replacement policy object |
pNewPolicy | new replacement policy object |
Implements CGUIImageCache.
|
protectedvirtual |
Deletes images from the cache until its size is reduced by uiSpaceToFree.
uiSpaceToFree | the amount of memory to be freed |
Implements CGUIImageCache.
|
virtual |
Determines the amount of memory used by the cached images.
Implements CGUIImageCache.
eC_UInt CGUIImageCacheImpl::GetFreeListSize | ( | ) | const |
Determines the amount of memory used by the cached images.
|
virtual |
Get the size of an image resource in memory.
eImageID | ID of the image. |
Implements CGUIImageCache.
eC_UInt CGUIImageCacheImpl::GetUsedListSize | ( | ) | const |
Determines the amount of memory used by the cached images in the used list.
|
protectedvirtual |
Tries to load an image and adds it to the cache. Needed space is freed before adding, if necessary.
psPath | the path to the image file. Used for determining the size and for the actual loading. |
eImageID | the image's ID |
Implements CGUIImageCache.
|
protectedvirtual |
Moves an (already loaded) image to the list of cached (but unused) images. The image is moved from the used list to the free list.
eImageID | the image's ID |
Implements CGUIImageCache.
|
protectedvirtual |
Marks an (already loaded) image as used. The image is moved from the free list to the used list.
eImageID | the image's ID |
Implements CGUIImageCache.
|
protectedvirtual |
Notifies the cache about an access (e.g. blitting,...) to an image.
eImageID | the image that was accessed. |
Implements CGUIImageCache.
|
protectedvirtual |
Special version of LoadImage for preloading images at start-up. Once the cache is full, needed space is not freed and no more images are preloaded.
psPath | the path to the image file used for determining the size and for the actual loading |
eImageID | the image's ID |
Implements CGUIImageCache.
|
virtual |
Reads the cache settings from a file. GUIStreamReader has to be initialized.
rkPath | to the destination file. |
Implements CGUIImageCache.
|
protectedvirtual |
Unloads a specific image and removes it from the free list.
eImageID | the image's ID |
Implements CGUIImageCache.
|
friend |