WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
Hash.h
1#ifndef _WINC_HASH
2#define _WINC_HASH
3
4namespace WXP {
5 class Hash {
6 int type; /* The type of hash */
7 int size; /* The vertical table size */
8 int data_size; /* The size in bytes of the data in table */
9
10 struct HashEntry {
11 char *key; /* The key to the element in the table */
12 char *data; /* The data stored in the database */
13 HashEntry *link; /* A link to the next element at that hash address */
14 HashEntry *next; /* A link to the next element in the order
15 entered into the database */
16 };
17
18 HashEntry *cur; /* Pointer to element in table based on order entered */
19 HashEntry *head; /* Pointer to head element based on order entered */
20 HashEntry *last; /* Pointer to last element based on order entered */
21 int num; /* Total number of entries in table */
22 int numkey; /* The number of keys used to search table */
23 HashEntry **table[4];/* Pointer to tables based on keys */
24
25 int initClass();
26 int clearAll();
27
28 public:
29 Hash( int rtype, int rsize, int rdata_size, int rnumkey );
30 Hash( int rsize, int rdata_size, int rnumkey );
31 Hash( int rtype );
32 Hash();
33 ~Hash();
34 int init();
35 int set( int rtype, int rsize, int rdata_size, int rnumkey );
36 int set( int rsize, int rdata_size, int rnumkey );
37 int set( int rtype );
38 int set();
39 int key( const char *rkey );
40 int enter( const char *data, ... );
41 char *search( int keynum, const char *key );
42 char *search( const char *key );
43 int searchInt( int keynum, const char *rkey );
44 int searchInt( const char *rkey );
45 int searchBool( int keynum, const char *rkey );
46 int searchBool( const char *rkey );
47 float searchFloat( int keynum, const char *rkey );
48 float searchFloat( const char *rkey );
49 int first();
50 char *next();
51 char *nextKey();
52 int clear();
53 inline int getSize(){ return size; };
54 inline int getDataSize(){ return data_size; };
55 inline int getNumKey(){ return numkey; };
56 inline int getNum(){ return num; };
57 int print();
58 int printData();
59 int printHash();
60
61 enum {
62 STRING,
63 BOOL,
64 INT,
65 FLOAT,
66 DATA
67 };
68 };
69}
70#endif
This class creates and manages generic hash tables.
Definition Hash.h:5
int searchBool(int keynum, const char *rkey)
Definition Hash.cc:347
int clear()
Definition Hash.cc:465
~Hash()
Definition Hash.cc:67
int key(const char *rkey)
Definition Hash.cc:76
int enter(const char *data,...)
Definition Hash.cc:173
int print()
Definition Hash.cc:489
int printHash()
Definition Hash.cc:517
char * search(int keynum, const char *key)
Definition Hash.cc:275
int searchInt(int keynum, const char *rkey)
Definition Hash.cc:310
float searchFloat(int keynum, const char *rkey)
Definition Hash.cc:384
int set()
Definition Hash.cc:161
char * next()
Definition Hash.cc:427
int printData()
Definition Hash.cc:500
int init()
Definition Hash.cc:103
int first()
Definition Hash.cc:418
char * nextKey()
Definition Hash.cc:442
Hash()
Definition Hash.cc:58
All WXP classes fall under the WXP namespace.
Definition Angle.h:4