SymbolTable Class Reference

Class holding symbol table for a graph/FSM. More...

#include <util.H>

List of all members.

Public Member Functions

 SymbolTable (const string &fileName=string())
 Ctor; loads from file fileName if argument present.
void read (const string &fileName)
 Reads symbols from file fileName.
void clear ()
 Clears object.
unsigned size () const
 Returns number of symbols in table.
bool empty () const
 Returns whether symbol table is empty.
int get_index (const string &theStr) const
 Maps from a string to its index.
string get_str (unsigned theIdx) const
 Maps from an index to its string.


Detailed Description

Class holding symbol table for a graph/FSM.

In graphs/FSM's, word labels are stored internally as integers. This object holds the mapping from word spellings to their integer representations, and vice versa. Word indices are constrained to be nonnegative, though they need not be consecutive. By convention, the word index corresponding to epsilon (i.e., the representation of the empty string) is 0.


Constructor & Destructor Documentation

SymbolTable::SymbolTable ( const string &  fileName = string()  )  [inline]

Ctor; loads from file fileName if argument present.


Member Function Documentation

void SymbolTable::read ( const string &  fileName  ) 

Reads symbols from file fileName.

void SymbolTable::clear (  ) 

Clears object.

unsigned SymbolTable::size (  )  const [inline]

Returns number of symbols in table.

bool SymbolTable::empty (  )  const [inline]

Returns whether symbol table is empty.

int SymbolTable::get_index ( const string &  theStr  )  const [inline]

Maps from a string to its index.

If not in table, returns -1.

string SymbolTable::get_str ( unsigned  theIdx  )  const [inline]

Maps from an index to its string.

If not in table, returns empty string.


The documentation for this class was generated from the following file:

Generated on Thu Nov 5 09:26:37 2009 for asr_lib by  doxygen 1.5.5