feisty meow concerns codebase
2.140
|
Maintains a list of names, where each name has a type and some contents. More...
#include <symbol_table.h>
Public Member Functions | |
symbol_table (int estimated_elements=100) | |
constructs a symbol table with sufficient size for "estimated_elements". More... | |
symbol_table (const symbol_table< contents > &to_copy) | |
~symbol_table () | |
int | symbols () const |
returns the number of symbols listed in the table. More... | |
int | estimated_elements () const |
returns the number of symbols the table is optimized for. More... | |
void | rehash (int estimated_elements) |
resizes underlying table to support "estimated_elements". More... | |
void | hash_appropriately (int estimated_elements) |
Resizes the number of table slots to have space for "estimated_elements". More... | |
symbol_table & | operator= (const symbol_table< contents > &to_copy) |
basis::outcome | add (const basis::astring &name, const contents &storage) |
Enters a symbol name into the table along with some contents. More... | |
const basis::astring & | name (int index) const |
returns the name held at the "index". More... | |
void | names (string_set &to_fill) const |
returns the names of all the symbols currently held. More... | |
contents & | operator[] (int index) |
provides access to the symbol_table's contents at the "index". More... | |
const contents & | operator[] (int index) const |
provides a constant peek at the contents at the "index". More... | |
const contents & | get (int index) const |
named equivalent for the bracket operator. More... | |
contents & | use (int index) |
named equivalent for the bracket operator. More... | |
contents * | find (const basis::astring &name) const |
returns the contents held for "name" or NULL_POINTER if it wasn't found. More... | |
contents * | find (const basis::astring &name, basis::string_comparator_function *comparator) const |
Specialized search via a comparison method "comparator". More... | |
int | dep_find (const basis::astring &name) const |
Searches for a symbol by its "name". More... | |
basis::outcome | retrieve (int index, basis::astring &symbol_name, contents &contains) const |
Locates the symbol at position "index" and stores it to the parameters. More... | |
basis::outcome | whack (const basis::astring &name) |
removes a symbol from the table. More... | |
basis::outcome | zap_index (int index) |
zaps the entry at the specified index. slower than whack(). More... | |
void | reset () |
Maintains a list of names, where each name has a type and some contents.
Definition at line 35 of file symbol_table.h.
structures::symbol_table< contents >::symbol_table | ( | int | estimated_elements = 100 | ) |
constructs a symbol table with sufficient size for "estimated_elements".
the "estimated_elements" dictates how large the symbol table's key space is. the number of keys that can be stored without collisions (assuming perfect distribution from the hash function) will be close to the number of elements specified.
Definition at line 206 of file symbol_table.h.
structures::symbol_table< contents >::symbol_table | ( | const symbol_table< contents > & | to_copy | ) |
Definition at line 212 of file symbol_table.h.
structures::symbol_table< contents >::~symbol_table |
Definition at line 219 of file symbol_table.h.
References basis::WHACK().
basis::outcome structures::symbol_table< contents >::add | ( | const basis::astring & | name, |
const contents & | storage | ||
) |
Enters a symbol name into the table along with some contents.
If the name already exists in the table, then the previous contents are replaced with these, but EXISTING is returned. If this is a new entry, then IS_NEW is returned instead.
Definition at line 383 of file symbol_table.h.
References structures::internal_symbol_info< contents >::_content.
Referenced by processes::configured_applications::add_program(), processes::configured_applications::add_startup_entry(), processes::configured_applications::configured_applications(), configuration::registry_configurator::get_section(), configuration::table_configurator::get_section(), configuration::variable_tokenizer::parse(), bookmark_tree::process_category(), and configuration::table_configurator::put().
int structures::symbol_table< contents >::dep_find | ( | const basis::astring & | name | ) | const |
Searches for a symbol by its "name".
Returns the index or NOT_FOUND. NOTE: this is deprecated; it is far faster to use the first find method above.
Definition at line 322 of file symbol_table.h.
int structures::symbol_table< contents >::estimated_elements |
returns the number of symbols the table is optimized for.
Definition at line 226 of file symbol_table.h.
contents * structures::symbol_table< contents >::find | ( | const basis::astring & | name | ) | const |
returns the contents held for "name" or NULL_POINTER if it wasn't found.
Definition at line 313 of file symbol_table.h.
References structures::internal_symbol_info< contents >::_content, and NULL_POINTER.
Referenced by configuration::variable_tokenizer::exists(), configuration::variable_tokenizer::find(), processes::configured_applications::find_entry(), configuration::table_configurator::get(), structures::string_table::operator==(), bookmark_tree::process_category(), and structures::symbol_table_compare().
contents * structures::symbol_table< contents >::find | ( | const basis::astring & | name, |
basis::string_comparator_function * | comparator | ||
) | const |
Specialized search via a comparison method "comparator".
Searches for a symbol by its "name" but uses a special comparison function "comparator" to determine if the name is really equal. This method is by its nature slower than the main find method, since all buckets must be searched until a match is found. It is just intended to provide extensibility.
Definition at line 364 of file symbol_table.h.
References FUNCDEF, LOG, structures::pack(), and structures::sym_tab_finder_apply().
|
inline |
named equivalent for the bracket operator.
Definition at line 80 of file symbol_table.h.
References structures::symbol_table< contents >::operator[]().
void structures::symbol_table< contents >::hash_appropriately | ( | int | estimated_elements | ) |
Resizes the number of table slots to have space for "estimated_elements".
Definition at line 237 of file symbol_table.h.
const basis::astring & structures::symbol_table< contents >::name | ( | int | index | ) | const |
returns the name held at the "index".
if the index is invalid, then a bogus name is returned.
Definition at line 272 of file symbol_table.h.
References bounds_return.
Referenced by processes::configured_applications::add_program(), textual::list_parsing::create_csv_line(), write_build_config::execute(), configuration::table_configurator::get_section(), configuration::section_manager::get_section_names(), configuration::ini_parser::merge_section(), write_build_config::output_definition_macro(), configuration::registry_configurator::put_section(), and configuration::variable_tokenizer::text_form().
void structures::symbol_table< contents >::names | ( | string_set & | to_fill | ) | const |
returns the names of all the symbols currently held.
Definition at line 279 of file symbol_table.h.
References basis::array< contents >::reset().
Referenced by configuration::config_watcher::changed_items(), configuration::config_watcher::deleted_items(), configuration::config_watcher::new_items(), and structures::symbol_table_compare().
symbol_table< contents > & structures::symbol_table< contents >::operator= | ( | const symbol_table< contents > & | to_copy | ) |
Definition at line 245 of file symbol_table.h.
References structures::internal_symbol_info< contents >::_name, and structures::symbol_table< contents >::symbols().
contents & structures::symbol_table< contents >::operator[] | ( | int | index | ) |
provides access to the symbol_table's contents at the "index".
Definition at line 304 of file symbol_table.h.
References structures::internal_symbol_info< contents >::_content, and bounds_return.
Referenced by structures::symbol_table< contents >::get(), and structures::symbol_table< contents >::use().
const contents & structures::symbol_table< contents >::operator[] | ( | int | index | ) | const |
provides a constant peek at the contents at the "index".
Definition at line 295 of file symbol_table.h.
References structures::internal_symbol_info< contents >::_content, and bounds_return.
void structures::symbol_table< contents >::rehash | ( | int | estimated_elements | ) |
resizes underlying table to support "estimated_elements".
Definition at line 230 of file symbol_table.h.
void structures::symbol_table< contents >::reset |
Definition at line 265 of file symbol_table.h.
Referenced by processes::configured_applications::find_section(), configuration::registry_configurator::get_section(), configuration::ini_configurator::get_section(), configuration::table_configurator::get_section(), and configuration::variable_tokenizer::reset().
basis::outcome structures::symbol_table< contents >::retrieve | ( | int | index, |
basis::astring & | symbol_name, | ||
contents & | contains | ||
) | const |
Locates the symbol at position "index" and stores it to the parameters.
retrieve() accesses the "index"th symbol in the table and returns the held contents for it as well as its name. if the outcome is OKAY, then the returned information is valid. otherwise, the search failed.
Definition at line 423 of file symbol_table.h.
References structures::internal_symbol_info< contents >::_content, structures::internal_symbol_info< contents >::_name, and bounds_return.
int structures::symbol_table< contents >::symbols |
returns the number of symbols listed in the table.
Definition at line 241 of file symbol_table.h.
Referenced by processes::configured_applications::add_program(), configuration::section_manager::add_section(), textual::list_parsing::create_csv_line(), unit_test::unit_base::final_report(), configuration::table_configurator::get_section(), configuration::section_manager::get_section_names(), textual::xml_parser::header_callback(), configuration::ini_parser::merge_section(), structures::symbol_table< contents >::operator=(), structures::string_table::operator==(), configuration::registry_configurator::put_section(), configuration::section_manager::replace_section(), configuration::variable_tokenizer::symbols(), textual::xml_parser::tag_open_callback(), and configuration::variable_tokenizer::text_form().
|
inline |
named equivalent for the bracket operator.
Definition at line 82 of file symbol_table.h.
References structures::symbol_table< contents >::operator[]().
basis::outcome structures::symbol_table< contents >::whack | ( | const basis::astring & | name | ) |
removes a symbol from the table.
this succeeds only if the symbol name is present in the table.
Definition at line 410 of file symbol_table.h.
Referenced by processes::configured_applications::add_program(), configuration::table_configurator::delete_entry(), processes::configured_applications::remove_program(), and processes::configured_applications::remove_startup_entry().
basis::outcome structures::symbol_table< contents >::zap_index | ( | int | index | ) |
zaps the entry at the specified index. slower than whack().
Definition at line 403 of file symbol_table.h.