NAME

ACE_Hash_Purgable_Map_Manager_Ex - Define a purgable map abstraction that efficiently associates EXT_IDs with INT_IDs.

SYNOPSIS

#include <ace/Hash_Purgable_Map_Manager_T.h>

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> class ACE_Hash_Purgable_Map_Manager_Ex : public ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> { public: typedef ACE_Hash_Purgable_Map_Entry<EXT_ID, INT_ID> PURGABLE_ENTRY; ACE_Hash_Purgable_Map_Manager_Ex (ACE_Allocator *alloc = 0); ACE_Hash_Purgable_Map_Manager_Ex ( size_t size, ACE_Allocator *alloc = 0 ); ~ACE_Hash_Purgable_Map_Manager_Ex (void); int purge (int num); protected: int purge_i (int num); int shared_find ( const EXT_ID &ext_id, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry, u_long &loc ); ACE_Hash_Map_Entry<EXT_ID, INT_ID> *create_entry ( ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next = 0, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev = 0 ); ACE_Hash_Map_Entry<EXT_ID, INT_ID> *create_entry ( const EXT_ID &ext_id, const INT_ID &int_id, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next = 0, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev = 0 ); int purge (void); u_long timer_; };

DESCRIPTION

This implementation of a map uses a purgable hash table. Key hashing is achieved through the HASH_KEY object and key comparison is achieved through the COMPARE_KEYS object.

This class provides the feature of purging the entries on need based on the purging algorithm followed. By default the Least Recently Used algorithm is applied for purging "k" entires from the map.

The Least Recently used algorithm is used to decide on the entry to purge. For this a timesatmp is used per entry with a virtual timer providing the timestamp-value. On a lookup or use of an entry, its timestamp value is updated proving that the entry has been used recently. When the map gets full and some entries need to be purged, the "K" entries with minimum timestamp are removed.

Initialization and termination methods.

ACE_Hash_Purgable_Map_Manager_Ex (ACE_Allocator *alloc = 0);

ACE_Hash_Purgable_Map_Manager_Ex (
    size_t size,
    ACE_Allocator *alloc = 0
    );

~ACE_Hash_Purgable_Map_Manager_Ex (void);

int purge (int num);

AUTHOR

Kirthika Parameswaran kirthika@cs.wustl.edu

LIBRARY

ace