|
Aegis
4.25.D505
|
#include <symtab.h>
Data Structures | |
| struct | row_t |
Public Types | |
| typedef void(* | callback_t )(const symtab_ty *stp, const nstring &key, void *data, void *arg) |
| typedef void(* | reaper_t )(void *) |
Public Member Functions | |
| ~symtab_ty () | |
| symtab_ty (int suggested_size=5) | |
| size_t | size () const |
| bool | empty () const |
| void | clear (void) |
| void * | query (string_ty *key) const |
| void * | query (const nstring &key) const |
| void * | query (const nstring_list &keys) const |
| string_ty * | query_fuzzy (string_ty *key) const |
| nstring | query_fuzzy (const nstring &key) const |
| void | assign (string_ty *key, void *value) |
| void | assign (const nstring &key, void *value) |
| void | assign_push (string_ty *key, void *value) |
| void | assign_push (const nstring &key, void *value) |
| void | remove (string_ty *key) |
| void | remove (const nstring &key) |
| void | dump (const char *caption) const |
| void | keys (string_list_ty *result) const |
| void | keys (nstring_list &result) const |
| void | walk (callback_t func, void *arg) const |
| void | set_reap (reaper_t func) |
| bool | valid () const |
Private Member Functions | |
| void | split (void) |
| symtab_ty (const symtab_ty &) | |
| symtab_ty & | operator= (const symtab_ty &) |
Private Attributes | |
| reaper_t | reap |
| row_t ** | hash_table |
| str_hash_ty | hash_modulus |
| str_hash_ty | hash_mask |
| str_hash_ty | hash_load |
Friends | |
| class | symtab_iterator |
The symtab_ty class is used to represent a symbol table. All data is referenced through void pointers. You may wish to use the template wrapper for type safety.
| typedef void(* symtab_ty::callback_t)(const symtab_ty *stp, const nstring &key, void *data, void *arg) |
| typedef void(* symtab_ty::reaper_t)(void *) |
The destructor.
| symtab_ty::symtab_ty | ( | int | suggested_size = 5 | ) |
The constructor.
| suggested_size | You are able to suggest how many rows will be in the table. It is better to under estimate than overestimate and waste memory. Optimal resizing happens automagically. |
| symtab_ty::symtab_ty | ( | const symtab_ty & | ) | [private] |
The copy constructor. Do not use.
| void symtab_ty::assign | ( | string_ty * | key, |
| void * | value | ||
| ) |
The assign method is used to assign a value to a given variable.
| key | They key (usually a variable name or simialar). |
| value | The value to be assigned to that name. |
| void symtab_ty::assign | ( | const nstring & | key, |
| void * | value | ||
| ) |
The assign method is used to assign a value to a given variable.
| key | They key (usually a variable name or simialar). |
| value | The value to be assigned to that name. |
| void symtab_ty::assign_push | ( | string_ty * | key, |
| void * | value | ||
| ) |
The assign_push function is used to assign a value to a given variable. Any previous value will be obscured until this one is removed with the remove method.
| key | They key (usually a variable name or simialar). |
| value | The value to be assigned to that name. |
| void symtab_ty::assign_push | ( | const nstring & | key, |
| void * | value | ||
| ) |
The assign_push function is used to assign a value to a given variable. Any previous value will be obscured until this one is removed with the remove method.
| key | They key (usually a variable name or simialar). |
| value | The value to be assigned to that name. |
| void symtab_ty::clear | ( | void | ) |
The clear method may be used to discard all rows of the symbol table. It is not an error if the symbol table is already empty.
| void symtab_ty::dump | ( | const char * | caption | ) | const |
The dump method is used to dump the contents of the symbol table.
| caption | The caption will be used to indicate why the symbol table was dumped. |
| bool symtab_ty::empty | ( | void | ) | const [inline] |
| void symtab_ty::keys | ( | string_list_ty * | result | ) | const |
The keys method may be used to extract the list of row names from the symbol table.
| result | Where to put the row names. It is cleared before any row names are placed in it. It is not sorted. |
| void symtab_ty::keys | ( | nstring_list & | result | ) | const |
The keys method may be used to extract the list of row names from the symbol table.
| result | Where to put the row names. It is cleared before any row names are placed in it. It is not sorted. |
The assignment operator. Do not use.
| void* symtab_ty::query | ( | string_ty * | key | ) | const |
The query method may be used to search for a variable.
| key | The row name to search for. |
| void* symtab_ty::query | ( | const nstring & | key | ) | const |
The query method may be used to search for a variable.
| key | The row name to search for. |
| void* symtab_ty::query | ( | const nstring_list & | keys | ) | const |
The query method may be used to search for a variable.
| keys | The row names to search for. The first found will be returned. |
| string_ty* symtab_ty::query_fuzzy | ( | string_ty * | key | ) | const |
The query_fuzzy method may be used to search for a variable.
| key | The row name to search for. |
| nstring symtab_ty::query_fuzzy | ( | const nstring & | key | ) | const |
The query_fuzzy method may be used to search for a variable.
| key | The row name to search for. |
| void symtab_ty::remove | ( | string_ty * | key | ) |
The remove method is used to remove a variable from the symbol table.
| key | The name of the row to be removed. |
| void symtab_ty::remove | ( | const nstring & | key | ) |
The remove method is used to remove a variable from the symbol table.
| key | The name of the row to be removed. |
| void symtab_ty::set_reap | ( | reaper_t | func | ) | [inline] |
| size_t symtab_ty::size | ( | void | ) | const [inline] |
| void symtab_ty::split | ( | void | ) | [private] |
The split method is used to double the number of buckets in the symbol table, which results in halving the load. The symbols are then redistributed into the new buckets.
| bool symtab_ty::valid | ( | ) | const |
The valid method determines whether the symbol table's internal values are self consistent. Usually only used for debugging.
| void symtab_ty::walk | ( | callback_t | func, |
| void * | arg | ||
| ) | const |
The walk method is used to invoke a func tion for every row of the symbol table.
| func | A pointer to the function to be called. |
| arg | An extra argument passed to the function. |
friend class symtab_iterator [friend] |
str_hash_ty symtab_ty::hash_load [private] |
str_hash_ty symtab_ty::hash_mask [private] |
str_hash_ty symtab_ty::hash_modulus [private] |
row_t** symtab_ty::hash_table [private] |
reaper_t symtab_ty::reap [private] |
1.7.6.1