/* * Copyright 2001 Perforce Software. All rights reserved. * * This file is part of Perforce - the FAST SCM System. */ /* * hash.h - simple in-memory hashing routines * * This class implements a simple hashing scheme. The client is * expected to subclass Hash, providing type-specific Compare(), * Key(), Delete(), and New() methods for the hashed data. * * The default Compare(), Key(), and Delete() assume that the * hashed item begins with a char * key. * * Classes: * * Hash - simple in-memory hashing routines * * Methods: * * Hash::Find() - lookup item, possibly entering it * Hash::Enter() - enter item into table * Hash::Check() - lookup item, without entering it * Hash::Keystring() - produce an integer hash of a string * Hash::Stats() - dump out hash table statistics (stdout) * * Virtual Methods, provided by subclass: * * Hash::Compare() - compare two items * Hash::Key() - produce an integer hash of item's key * Hash::Delete() - delete an item * Hash::New() - create an item */ struct Hash { public: int Find( void **data, int enter ); int Enter( void **data ) { return !Find( data, !0 ); } int Check( void **data ) { return Find( data, 0 ); } public: Hash( char *name ); virtual ~Hash(); virtual int Compare( void *d1, void *d2 ); virtual int Key( void *d1 ); virtual void Delete( void *d1 ); virtual void * New() = 0; int KeyString( const char *s ); void Stats(); private: void Rehash(); struct Hasher *hp; } ;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 18760 | rlranft |
Populate -o //guest/perforce_software/p4/... //guest/rlranft/p4/.... |
||
//guest/perforce_software/p4/2014-1/support/hash.h | |||||
#1 | 15902 | Matt Attaway | A second renaming that I will not obliterate as a badge of shame | ||
//guest/perforce_software/p4/2014_1/support/hash.h | |||||
#1 | 15901 | Matt Attaway | Clean up code to fit modern Workshop naming standards | ||
//guest/perforce_software/p4/2014.1/support/hash.h | |||||
#1 | 12188 | Matt Attaway | Move 'main' p4 into a release specific directory in prep for new releases | ||
//guest/perforce_software/p4/support/hash.h | |||||
#1 | 9129 | Matt Attaway | Initial commit of the 2014.1 p4/p4api source code |