class TCacheArray

More...

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

Public Methods

Public Members

Protected Methods

Protected Members

Private Types

Private Members


Detailed Description

template class TCacheArray template class TCacheArrayIterator

Cache generica di oggetti CBuf associati a chiave CKey senza limitazioni sulle dimensioni, con indicizzazione.

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.

L'uso dell'array consente di inserire quanti elementi si vuole nella cache senza limiti di dimensioni, inoltre le funzioni di ricerca ritornano l'indice dell'array piuttosto che gli oggetti CBuf relativi.

typedef TDDAssociation Association

Association

[private]

typedef TIDictionaryAsHashTable Dictionary

Dictionary

[private]

typedef TIArrayAsVector Array

Array

[private]

friend class TCacheArrayIterator

TCacheArrayIterator

[private]

typedef void  (*IterFunc) (CBuf&, void *)

(*IterFunc)

typedef int  (*CondFunc) (const CBuf&, void *)

(*CondFunc)

 TCacheArray ( unsigned szDic = DEFAULT_HASH_TABLE_SIZE )

TCacheArray

 ~TCacheArray ()

~TCacheArray

[virtual]

int  OwnsElements ()

OwnsElements

Reimplemented from TShouldDelete.

void  OwnsElements ( int del )

OwnsElements

Reimplemented from TShouldDelete.

int  AcceptDouble ()

AcceptDouble

void  AcceptDouble (int Flag)

AcceptDouble

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

Add

const CBuf * Find ( const CKey& k )

Find

int  FindIndex ( const CKey& k )

FindIndex

int  Fetch ( const CKey& k )

Fetch

void  Flush ( DeleteType dt = DefDelete )

Flush

int  FillCache ( const CKey& )

FillCache

[virtual]

CBuf *&  operator [] ( int loc )

operator []

CBuf *&  operator [] ( int loc )

operator []

[const]

void  ForEach ( IterFunc iter, void *args )

ForEach

CBuf * FirstThat ( CondFunc cond, void *args )

FirstThat

[const]

CBuf * LastThat ( CondFunc cond, void *args )

LastThat

[const]

unsigned  GetItemsInContainer ()

GetItemsInContainer

[const]

int  IsEmpty ()

IsEmpty

[const]

Array ary

ary

[protected]

Dictionary dic

dic

[protected]

unsigned AccettaDuplicati

AccettaDuplicati

[protected]

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

Add

[protected]

template int  FindIndex ( const CKey& k )

FindIndex

[protected]

template const CBuf*  Find ( const CKey& k )

Find

[protected]

template void  Flush ( DeleteType dt )

Flush

[protected]

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