#include <sbFixedInterfaceCache.h>
Public Types | |
typedef KeyClass::KeyType | KeyType |
Public Member Functions | |
sbFixedInterfaceCache (PRUint32 aSize) | |
~sbFixedInterfaceCache () | |
void | Put (KeyType aKey, Interface *aValue) |
Interface * | Get (KeyType aKey) const |
This class provides a fixed size cache for interface pointers. It holds an owning reference to the pointer, but hands out raw pointers that much be AddRef'd by the caller if they wish to hold on to it. The cache is populated from the end to make it easy to search the most recently added entry. The class now sports a hash implementation so lookups are fast and this makes the cache much more scalable and negates the power of 2 requirement on the size.
Definition at line 46 of file sbFixedInterfaceCache.h.
typedef KeyClass::KeyType sbFixedInterfaceCache< KeyClass, Interface >::KeyType |
Definition at line 49 of file sbFixedInterfaceCache.h.
|
inline |
Initializes the key array and hash to the cache size. NOTE: The size must be a power of 2
Definition at line 55 of file sbFixedInterfaceCache.h.
|
inline |
Releases references to the bags we're holding
Definition at line 67 of file sbFixedInterfaceCache.h.
|
inline |
Returns the interface pointer for aKey. If it's not found then nsnull is returned. The pointer returned is not addref'd so if you want to keep it around be sure to do it youself
Definition at line 104 of file sbFixedInterfaceCache.h.
|
inline |
Replaces or adds the interface pointer for aKey. The previous interface pointer is released if there is one.
Definition at line 80 of file sbFixedInterfaceCache.h.