Classes and routines used to cache interface resources.

lclrescache.pas contains classes and routines used to cache interface resources. See graphics.pp for examples.

This file is part of the Lazarus Component Library (LCL).

Author: Mattias Gaertner

TResourceCacheItem - an item in a list (TResourceCache). FDestroying - local boolean variable to store Destroying status. FReferenceCount - local variable to store Reference Count. Handle for Cache Item - use TLCLHandle instead of THandle since THandle = longint under 64bit linux. The Resource Cache to which this Cache Item belongs. FirstDescriptor - the descriptor for the first item in the list. LastDescriptor - the descriptor for the last item in the list. The Next item in the list. Prev - the previous item in the list. Constructor for the class instance. TObject.Create Destructor for the class instance. TObject.Destroy IncreaseRefCount - increment the reference count. DecreaseRefCount - decrement the reference count. AddToList - add an item to the cache list specified by First, Last. RemoveFromList - remove an item from the cache list specified by First, Last. WarnReferenceHigh - issue a warning if the number of references gets too high. ReferenceCount - the number of references to this Item. Class reference used to create new TResourceCacheItem instances. TResourceCacheDescriptor - a class of descriptors for ResourceCache Items. FDestroying - local boolean variable to store Destroying status. Item - the Resource Cache Item to which this descriptor refers. Cache - the resource Cache to which this Item belongs. The Next descriptor in the list. Prev - the Previous descriptor in the list. Constructor for the class instance. TObject.Create Destructor for the class instance. TObject.Destroy AddToList - add a descriptor to the list specified by First, Last. RemoveFromList - remove a descriptor from the list specified by First, Last. Class reference used to create new TResourceCacheDescriptor instances. TResourceCache - a cache (linked list) for storing Resources. FDestroying - local boolean variable to store Destroying status. FResourceCacheDescriptorClass - local variable for holding the class of the current descriptor. FResourceCacheItemClass - local variable for holding the class of the current cache item. FMaxUnusedItem - how many freed resources to keep. FFirstUnusedItem - local variable storing location of first free item. FLastUnusedItem - local variable storing location of last free item. FUnUsedItemCount - local variable with count of free items. RemoveItem from CacheItem list. RemoveDescriptor from Cache Descriptor list. ItemUsed - method for signalling that the specified Item is being used. ItemUnused - method for signalling that the specified Item is unused. ItemIsUsed - returns True if specified Item is being used. Constructor for the class instance.

Allocates resources for the internal TAVLTree instances used for items and descriptors in the class instance, and sets the default values for properties.

Clears the current entries in the Resource Cache.

Frees entries in the internal items and descriptors for the resource cache.

Destructor for the class instance.

Frees resources allocates in the Create constructor, and calls the inherited method prior to exit.

CompareItems - returns 0 if items are equal, -1 if Item1 is less, 1 if Item1 is greater. CompareDescriptors - returns 0 if descriptors are equal, -1 if Desc1 is less, 1 if Desc1 is greater. ConsistencyCheck - checks that Items have valid descriptors. MaxUnusedItem - the largest permitted number of unused items. ResourceCacheItemClass - the Class of the current Cache Item. ResourceCacheDescriptorClass - the class of the current cache item descriptor. THandleResourceCache - a Resource Cache for Handles. FindItem - locate the item with the specified Handle. TBlockResourceCacheDescriptor - descriptor for a Block Resource Cache. Pointer to the Data. Destructor for the class instance. TBlockResourceCache - a cache for Block resources. FOnCompareDescPtrWithDescriptor - local variable to hold the result of a comparison between a descriptor pointer and the descriptor itself. Constructor for the class instance.

Allocates resources needed for the cache descriptor. Sets the initial DataSize for the cache. Assign the default compare routine used for the block resources.

FindDescriptor - returns the descriptor whose pointer is given. AddResource - inserts a Block resource into the list, referenced by a handle and a descriptor pointer, and returns the Block Resource Cache descriptor. DataSize - the total size of the data in the Block Resource. OnCompareDescPtrWithDescriptor - the result of a comparison between a descriptor pointer and the descriptor itself.