class TCacheBlock

More...

Definition#include <classlib/include/classlib/tcache.h>
Template formTCacheBlock<class CKey,class CBuf>
InheritsTShouldDelete [private ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Protected Methods

Protected Members

Private Types

Private Members


Detailed Description

template class TCacheBlock template class TCacheBlockIterator

Cache generica di oggetti CBuf associati a chiave CKey senza limitazioni sulle dimensioni con raggruppamento dei dati per chiave.

Gli oggetti CKey sono memorizzati in forma diretta, mentre gli oggetti CBuf sono memorizzati in forma indiretta (puntatori a). 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.

La cache associa ad ogni chiave un array di oggetti buffer: quando si aggiuge la chiave per la prima volta viene creato l'array ed inserito il primo elemento CBuf nell'array. Successive add con la stessa chiave aggiungeranno all'array associato alla chiave il nuovo elemento buf. Quando si preleva un valore dalla cache attraverso Fetch viene restituito l'array dei valori associati alla chiave fornita. L'array e' del tipo TIArrayAsVector (vedi TIArrayAsVector).

typedef TIArrayAsVector Array

Array

[private]

typedef TCAssoc Association

Association

[private]

typedef TIDictionaryAsHashTable Dictionary

Dictionary

[private]

typedef TIDictionaryAsHashTableIterator IteratorDic

IteratorDic

[private]

friend class TCacheBlockIterator

TCacheBlockIterator

[private]

 TCacheBlock ( unsigned szDic = DEFAULT_HASH_TABLE_SIZE )

TCacheBlock

 ~TCacheBlock ()

~TCacheBlock

[virtual]

int  OwnsElements ()

OwnsElements

Reimplemented from TShouldDelete.

void  OwnsElements ( int del )

OwnsElements

Reimplemented from TShouldDelete.

const Array*  Add ( const CKey& k, CBuf* b )

Add

const Array*  Find ( const CKey& k )

Find

const Array*  Fetch ( const CKey& k )

Fetch

void  Flush ( DeleteType dt = DefDelete )

Flush

const Array*  FillCache ( const CKey& )

FillCache

[virtual]

unsigned  GetItemsInContainer ()

GetItemsInContainer

[const]

int  IsEmpty ()

IsEmpty

[const]

Dictionary dic

dic

[protected]

template const TIArrayAsVector*  Add ( const CKey& k, CBuf* b )

Add

[protected]

template const TIArrayAsVector*  Find ( const CKey& k )

Find

[protected]

template void  Flush ( DeleteType dt )

Flush

[protected]

template const TIArrayAsVector*  Fetch ( const CKey& k )

Fetch

[protected]


Generated by: nicola on gulliver.wadahome.it on Sun May 25 13:54:34 2003, using kdoc 2.0a53.