Public Methods
Protected Methods
- template
int Add ( const CKey& k, CBuf* b )
- template
const CBuf* Find ( const CKey& k )
- template
void Flush ( DeleteType dt )
- template
const CBuf* Fetch ( const CKey& k )
- template
void ForEach ( void (*func)(CKey&, CBuf&, void *), void *args )
Protected Members
Private Types
Private Members
template class TPriorityCache
template class TPriorityCacheIterator
Cache generica di oggetti CBuf associati a chiave CKey con priorità.
Gli oggetti CKey sono memorizzati in forma diretta, mentre gli oggetti
CBuf sono memorizzati in forma indiretta (puntatori a).
Notare il costruttore: szQue è la dimensione della cache (-1=nolimit)
L'oggetto chiave (CKey) è soggetto alle restrizioni delle HashTable
ossia deve avere un operatore di copia (=), uno di conronto (==) e
deve avere una funzione:
unsigned HashValue() const;
oppure deve esistere una funzione globale del tipo:
unsigned HashValue( const CKey& t );
Per prelevare gli oggetti dalla cache si usa la funzione Fetch; se
la chiave esiste viene ritornato l'oggetto CBuf associato, altrimenti
viene chiamata la funzione FillCache (ridefibile in classi derivate)
per reperire all'esterno l'oggetto; FillCache potrà a sua volta chia-
mare la funzione Add dopo aver reperito l'oggetto associato alla
chiave, per salvarlo nella cache.
Ridefinendo opportunamente IsPriority si può decidere se utilizzare o
o meno la priorità sulla cache. Se questa funzione restituisce != 0
ogni volta che Fetch va a buon fine, l'oggetto CBuf viene reinserito a
a priorità massima nella cache. In questo modo in caso di scaricamento
a causa riempimento, verranno scaricati gli elementi con accesso meno
frequente.
typedef TCAssoc Association | Association |
[private]
[private]
[private]
friend class TPriorityCacheIterator
| TPriorityCacheIterator |
[private]
TPriorityCache ( unsigned szCac = DEFAULT_QUEUE_SIZE,
unsigned szDic = DEFAULT_HASH_TABLE_SIZE )
| TPriorityCache |
~TPriorityCache ()
| ~TPriorityCache |
[virtual]
int OwnsElements ()
| OwnsElements |
Reimplemented from TShouldDelete.
void OwnsElements ( int del )
| OwnsElements |
Reimplemented from TShouldDelete.
int Add ( const CKey& k, CBuf* b )
| Add |
[virtual]
int Detach ( const CKey& k, DeleteType dt = DefDelete )
| Detach |
const CBuf * Find ( const CKey& k )
| Find |
const CBuf * Fetch ( const CKey& k )
| Fetch |
void Flush ( DeleteType dt = DefDelete )
| Flush |
const CBuf * FillCache ( const CKey& )
| FillCache |
[virtual]
int IsPriority ()
| IsPriority |
[const virtual]
void ForEach ( void (*func)(CKey&, CBuf&, void *),
void *args )
| ForEach |
unsigned GetItemsInContainer ()
| GetItemsInContainer |
[const]
[const]
[const]
[protected]
[protected]
int LimitCache
| LimitCache |
[protected]
template
int Add ( const CKey& k, CBuf* b )
| Add |
[protected]
template
const CBuf* Find ( const CKey& k )
| Find |
[protected]
template
void Flush ( DeleteType dt )
| Flush |
[protected]
template
const CBuf* Fetch ( const CKey& k )
| Fetch |
[protected]
template
void ForEach ( void (*func)(CKey&, CBuf&, void *), void *args )
| ForEach |
[protected]
Generated by: nicola on gulliver.wadahome.it on Sun May 25 13:54:34 2003, using kdoc 2.0a53. |