class TCache

More...

Definition#include <classlib/include/classlib/tcache.h>
Template formTCache<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 TCache template class TCacheIterator

Cache generica di oggetti CBuf associati a chiave CKey

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 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.

typedef TCAssoc Association

Association

[private]

typedef TIDictionaryAsHashTable Dictionary

Dictionary

[private]

typedef TIQueueAsVector Queue

Queue

[private]

friend class TCacheIterator

TCacheIterator

[private]

 TCache ( unsigned szQue = DEFAULT_QUEUE_SIZE, unsigned szDic = DEFAULT_HASH_TABLE_SIZE )

TCache

 ~TCache ()

~TCache

[virtual]

int  OwnsElements ()

OwnsElements

Reimplemented from TShouldDelete.

void  OwnsElements ( int del )

OwnsElements

Reimplemented from TShouldDelete.

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

Add

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]

void  ForEach ( void (*func)(CKey&, CBuf&, void *), void *args )

ForEach

unsigned  GetItemsInContainer ()

GetItemsInContainer

[const]

int  IsEmpty ()

IsEmpty

[const]

int  IsFull ()

IsFull

[const]

Queue que

que

[protected]

Dictionary dic

dic

[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.