SymTab Class Reference

Symbol Table: Stores the values of the variables defined by the user in the cli command interpreter. More...

#include <SymTab.h>

Inheritance diagram for SymTab:
Collaboration diagram for SymTab:

List of all members.

Public Types

typedef hashers< const
std::string, AData *, hash
< std::string >, eqstr >
::MapType 
table_t
 Hash map for names keys and objects.

Public Member Functions

 SymTab ()
 Constructs an empty symbol table.
int add_symbol (const std::string symbol, AData *data)
 Add a symbol and the associated value into the symbol table.
ADataget_symbol_value (const std::string symbol) const
 Returns the value currently associated with the given symbol.
bool get_symbol_value_copy (const std::string symbol, AData *data) const
 Returns a copy of the value associated with the given symbol in the 2nd argument.
int print_value (std::ostream &outputstream, const std::string symbol) const
 Prints the value of the symbol.
void print_all_values (std::ostream &outputstream) const
 Prints all symbols and values.
std::vector< string > get_symbols_by_class (const std::string classname, bool includesubclasses=true) const
 Returns a vector of symbols with the given type.
std::vector< std::string > get_all_symbols () const
 Returns a list of all symbols.

Friends

class boost::serialization::access
 The number of entries in the symbol table.


Detailed Description

Symbol Table: Stores the values of the variables defined by the user in the cli command interpreter.

It is possible to query by symbol name and by classname.

The symbol table is currently implemented using just an array to store values - lookup time is therefore linear. This is probably adequate for cli - however, the interface is general enough to accomodate a more scalable implementation in the future.


Member Function Documentation

bool SymTab::get_symbol_value_copy ( const std::string  symbol,
AData data 
) const

Returns a copy of the value associated with the given symbol in the 2nd argument.

Returns 0 if the symbol doesn't exist, and non-zero if it does.

int SymTab::print_value ( std::ostream &  outputstream,
const std::string  symbol 
) const

Prints the value of the symbol.

Returns zero if the symbol doesn't exist and couldn't be printed, and non-zero otherwise.

std::vector<string> SymTab::get_symbols_by_class ( const std::string  classname,
bool  includesubclasses = true 
) const

Returns a vector of symbols with the given type.

If the includesubclasses flag is true then subclasses are returned in the vector too.


The documentation for this class was generated from the following file:
  • /home/weinberg/src/BIE/include/SymTab.h

Send suggestions, questions, and feedback to WEINBERG at ASTRO dot UMASS dot EDU.
Documentation generated at Fri Mar 26 00:35:12 2010 by doxygen