WXP C++ Library Version 6.74.9
|
This class creates and manages generic hash tables. More...
#include "../include/Hash.h"
Public Types | |
enum | { STRING , BOOL , INT , FLOAT , DATA } |
Public Member Functions | |
Hash (int rtype, int rsize, int rdata_size, int rnumkey) | |
Hash (int rsize, int rdata_size, int rnumkey) | |
Hash (int rtype) | |
Hash () | |
~Hash () | |
int | init () |
int | set (int rtype, int rsize, int rdata_size, int rnumkey) |
int | set (int rsize, int rdata_size, int rnumkey) |
int | set (int rtype) |
int | set () |
int | key (const char *rkey) |
int | enter (const char *data,...) |
char * | search (int keynum, const char *key) |
char * | search (const char *key) |
int | searchInt (int keynum, const char *rkey) |
int | searchInt (const char *rkey) |
int | searchBool (int keynum, const char *rkey) |
int | searchBool (const char *rkey) |
float | searchFloat (int keynum, const char *rkey) |
float | searchFloat (const char *rkey) |
int | first () |
char * | next () |
char * | nextKey () |
int | clear () |
int | getSize () |
int | getDataSize () |
int | getNumKey () |
int | getNum () |
int | print () |
int | printData () |
int | printHash () |
This class creates and manages generic hash tables.
Hash::Hash | ( | int | rtype, |
int | rsize, | ||
int | rdata_size, | ||
int | rnumkey | ||
) |
Hash::Hash | ( | int | rsize, |
int | rdata_size, | ||
int | rnumkey | ||
) |
Hash::Hash | ( | int | rtype | ) |
Hash::~Hash | ( | ) |
Destructor
int Hash::clear | ( | ) |
Clears the data in the hash
int Hash::enter | ( | const char * | key1, |
... | |||
) |
Enters a new key into hash table
key1 | First key |
key2 | Second key (optional) |
key3 | Third key (optional) |
key4 | Fourth key (optional) |
data | Data |
References WXP::StrLib::acopy(), WXP::StrLib::equal(), and key().
Referenced by WXP::MdrHash::put(), WXP::RcmHash::put(), WXP::SfcHash::put(), WXP::UpaRawinHash::put(), WXP::CityHash::setup(), WXP::UpaRawinHash::setup(), WXP::CityHash::setup(), and WXP::DataMath::uniqueId().
int Hash::first | ( | ) |
Resets pointer to beginning of list. Use with next and nextKey methods.
Referenced by WXP::CityHash::first(), WXP::MdrHash::first(), and WXP::MdrHash::print().
int Hash::init | ( | ) |
int Hash::key | ( | const char * | rkey | ) |
This function returns the index in the hash table based on the hashing function.
rkey | String to pass to hash function |
Referenced by enter(), search(), searchBool(), searchFloat(), and searchInt().
char * Hash::next | ( | ) |
Moves to next key in list. Order based on ordered entered into table.
Referenced by WXP::MdrHash::next(), WXP::RcmHash::next(), WXP::SfcHash::next(), and WXP::MdrHash::print().
char * Hash::nextKey | ( | ) |
Moves to next key in list. Order based on ordered entered into table.
Referenced by WXP::CityHash::nextKey().
int Hash::print | ( | ) |
Prints hash table use stats
Referenced by WXP::CityHash::print(), and WXP::CityHash::printData().
int Hash::printData | ( | ) |
Prints all the data values stored in table.
int Hash::printHash | ( | ) |
Prints all the data values stored in table.
char * Hash::search | ( | const char * | rkey | ) |
Searches the hash for key (first key)
rkey | The key value to search for |
References search().
char * Hash::search | ( | int | keynum, |
const char * | rkey | ||
) |
Searches the hash for data
keynum | The key number to use |
rkey | The key value to search for |
References WXP::StrLib::equal(), and key().
Referenced by WXP::CityHash::get(), WXP::MdrHash::get(), WXP::RcmHash::get(), WXP::SfcHash::get(), WXP::UpaRawinHash::get(), WXP::CityHash::get(), WXP::UpaRawinHash::put(), and search().
int Hash::searchBool | ( | const char * | rkey | ) |
Searches the hash for key (first key). Returns boolean value
rkey | The key value to search for |
References searchBool().
int Hash::searchBool | ( | int | keynum, |
const char * | rkey | ||
) |
Searches the hash for key. Returns boolean value
keynum | The key number to use |
rkey | The key value to search for |
References WXP::StrLib::equal(), and key().
Referenced by searchBool(), and WXP::DataMath::uniqueId().
float Hash::searchFloat | ( | const char * | rkey | ) |
Searches the hash for key (first key). Returns float value
rkey | The key value to search for |
References searchFloat().
float Hash::searchFloat | ( | int | keynum, |
const char * | rkey | ||
) |
Searches the hash for key. Returns float value
keynum | The key number to use |
rkey | The key value to search for |
References WXP::StrLib::equal(), and key().
Referenced by searchFloat().
int Hash::searchInt | ( | const char * | rkey | ) |
Searches the hash for key (first key). Returns integer value
rkey | The key value to search for |
References searchInt().
int Hash::searchInt | ( | int | keynum, |
const char * | rkey | ||
) |
Searches the hash for key. Returns integer value
keynum | The key number to use |
rkey | The key value to search for |
References WXP::StrLib::equal(), key(), and WXP::Const::MISS.
Referenced by searchInt().
int Hash::set | ( | ) |
int Hash::set | ( | int | rsize, |
int | rdata_size, | ||
int | rnumkey | ||
) |
Sets up the initial table (STRING)
rsize | Size of hash table (entries) |
rdata_size | Size of data to be entered into hash |
rnumkey | Number of keys into table |
References set().
int Hash::set | ( | int | rtype | ) |
Sets up the initial table
rtype | Type of hash table (STRING, BOOL, INT, FLOAT, DATA) |
References set().
int Hash::set | ( | int | rtype, |
int | rsize, | ||
int | rdata_size, | ||
int | rnumkey | ||
) |
Sets up the initial table
rtype | Type of hash table (STRING, BOOL, INT, FLOAT, DATA) |
rsize | Size of hash table (entries) |
rdata_size | Size of data to be entered into hash |
rnumkey | Number of keys into table |
References init().
Referenced by WXP::MdrHash::init(), WXP::CityHash::setup(), WXP::UpaRawinHash::setup(), and WXP::CityHash::setup().