faudes::SymbolTable Class Reference

#include <symboltable.h>

List of all members.


Detailed Description

A SymbolTable associates sybolic names with indices.

Symbolic names are restricted to printable ascii, no quoatation ("), and no blanks. Indices are of type faudes Idx aka (long unsigned) integer and must be positive. Both, indices and symbolic names must be unique within each SymbolTable. Consistency checks on input data are preformed, regardless of the FAUDES_CHECKED compiletime option.

Generators refer to a global symboltable for event names and hold a local symboltable for state names.

Definition at line 52 of file symboltable.h.

Public Member Functions

 SymbolTable (void)
 Creates a new SymbolTable.
std::string Name (void) const
 Return name of SymbolTable.
void Name (const std::string &rName)
 Set name of SymbolTable.
Idx Size (void)
 Size of symboltabel.
void Clear (void)
 Clear all entries.
Idx MaxIndex (void) const
 Get maximum index which this SymbolTable accepts.
void MaxIndex (Idx index)
 Set maximum index which this SymbolTable accapts.
Idx LastIndex (void) const
 Get the largest index in use.
std::string Symbol (Idx index) const
 Symbolic name lookup.
Idx Index (const std::string &rName) const
 Index lookup.
bool Exists (Idx index) const
 Test existence of index.
bool Exists (const std::string &rName) const
 Test existence of symbol.
std::string UniqueSymbol (const std::string &rName) const
 Create unique symbolic name by adding an underscore and extra digits.
Idx InsEntry (Idx index, const std::string &rName)
 Add new entry (aka symbolic name and index) to symboltable,.
Idx InsEntry (const std::string &rName)
 Merge a symbolic name with symboltable.
void SetEntry (Idx index, const std::string &rName)
 Set symbolic name for existing entry.
void SetDefaultSymbol (Idx index)
 Set default names ("1", "2", "3", .
void ClrEntry (Idx index)
 Delete entry by index.
void ClrEntry (const std::string &rName)
 Delete entry by symbol.

Static Public Member Functions

static bool ValidSymbol (const std::string &rName)
 Test validiy of candidate symbol.
static SymbolTableGlobalEventSymbolTablep (void)
 Get Static Symboltable ref.

Private Attributes

std::string mMyName
 Name of the SymbolTable.
std::map< std::string, IdxmIndexMap
 Index lookup map.
std::map< Idx, std::string > mNameMap
 Name lookup map.
Idx mMaxIndex
 Upper limit (incl).
Idx mNextIndex
 Largest used index + 1.

Static Private Attributes

static SymbolTable msEventSymbolTable
 static event symbol table (should go to faudes::vGenerator, or faudes)


Constructor & Destructor Documentation

faudes::SymbolTable::SymbolTable void   ) 
 

Creates a new SymbolTable.

Definition at line 33 of file symboltable.cpp.


Member Function Documentation

void faudes::SymbolTable::Clear void   ) 
 

Clear all entries.

Definition at line 50 of file symboltable.cpp.

void faudes::SymbolTable::ClrEntry const std::string &  rName  ) 
 

Delete entry by symbol.

Parameters:
rName Symbolic name to delete

Definition at line 200 of file symboltable.cpp.

void faudes::SymbolTable::ClrEntry Idx  index  ) 
 

Delete entry by index.

Parameters:
index Index to delete

Definition at line 192 of file symboltable.cpp.

bool faudes::SymbolTable::Exists const std::string &  rName  )  const
 

Test existence of symbol.

Parameters:
rName Symbolic name to test
Returns:
True, if name exists

Definition at line 234 of file symboltable.cpp.

bool faudes::SymbolTable::Exists Idx  index  )  const
 

Test existence of index.

Parameters:
index Index to test
Returns:
True, if index exists

Definition at line 228 of file symboltable.cpp.

SymbolTable * faudes::SymbolTable::GlobalEventSymbolTablep void   )  [static]
 

Get Static Symboltable ref.

Definition at line 241 of file symboltable.cpp.

Idx faudes::SymbolTable::Index const std::string &  rName  )  const
 

Index lookup.

Parameters:
rName Symbolic name to lookup
Returns:
Index of symbolic name, or 0 for non-existent name

Definition at line 208 of file symboltable.cpp.

Idx faudes::SymbolTable::InsEntry const std::string &  rName  ) 
 

Merge a symbolic name with symboltable.

If the symbol does not exist, find a new index and add the new entry. If the symbol does exist, lookup its index.

Parameters:
rName Symbolic name to merge
Returns:
Index of rName
Exceptions:
Exception 
  • invalid name (id 43)

Definition at line 156 of file symboltable.cpp.

Idx faudes::SymbolTable::InsEntry Idx  index,
const std::string &  rName
 

Add new entry (aka symbolic name and index) to symboltable,.

Parameters:
index New index
rName New symbolic name
Returns:
New index
Exceptions:
Exception 
  • name already associated with another index (id 41)
  • index already associated with another name (id 42)
  • invalid name (id 43)

Definition at line 124 of file symboltable.cpp.

Idx faudes::SymbolTable::LastIndex void   )  const
 

Get the largest index in use.

Definition at line 79 of file symboltable.cpp.

void faudes::SymbolTable::MaxIndex Idx  index  ) 
 

Set maximum index which this SymbolTable accapts.

Parameters:
index New maximum index
Exceptions:
Exception 
  • symboltable overflow (id 40)

Definition at line 68 of file symboltable.cpp.

Idx faudes::SymbolTable::MaxIndex void   )  const
 

Get maximum index which this SymbolTable accepts.

Definition at line 63 of file symboltable.cpp.

void faudes::SymbolTable::Name const std::string &  rName  ) 
 

Set name of SymbolTable.

Definition at line 45 of file symboltable.cpp.

std::string faudes::SymbolTable::Name void   )  const
 

Return name of SymbolTable.

Definition at line 40 of file symboltable.cpp.

void faudes::SymbolTable::SetDefaultSymbol Idx  index  ) 
 

Set default names ("1", "2", "3", .

..) for index.

Parameters:
index Index for which to set the default name

Definition at line 181 of file symboltable.cpp.

void faudes::SymbolTable::SetEntry Idx  index,
const std::string &  rName
 

Set symbolic name for existing entry.

Parameters:
index Index to specify entry
rName New esymbolic name for index
Exceptions:
Exception 
  • name already associated with another index (id 41)
  • invalid name (id 43)

Definition at line 164 of file symboltable.cpp.

Idx faudes::SymbolTable::Size void   ) 
 

Size of symboltabel.

Definition at line 58 of file symboltable.cpp.

std::string faudes::SymbolTable::Symbol Idx  index  )  const
 

Symbolic name lookup.

Parameters:
index Index to lookup
Returns:
Symbolic name of index, or empty string "" for non-existent index

Definition at line 217 of file symboltable.cpp.

std::string faudes::SymbolTable::UniqueSymbol const std::string &  rName  )  const
 

Create unique symbolic name by adding an underscore and extra digits.

The current implementation tries to be smart and overwrites any previously added digits. It is also slow.

Parameters:
rName Candidate symbolic name
Returns:
Unique symbolic name

Definition at line 100 of file symboltable.cpp.

bool faudes::SymbolTable::ValidSymbol const std::string &  rName  )  [static]
 

Test validiy of candidate symbol.

The current implementation insists in printable ascii, no quotes (") and no blanks. The no-quotes-restriction simplifies file io (see tokenreader.h), other restrictions are cosmetic.

Parameters:
rName Symbolic name to test
Returns:
True, if name is a valid symbol

Definition at line 84 of file symboltable.cpp.


Member Data Documentation

std::map<std::string,Idx> faudes::SymbolTable::mIndexMap [private]
 

Index lookup map.

Definition at line 239 of file symboltable.h.

Idx faudes::SymbolTable::mMaxIndex [private]
 

Upper limit (incl).

Definition at line 245 of file symboltable.h.

std::string faudes::SymbolTable::mMyName [private]
 

Name of the SymbolTable.

Definition at line 236 of file symboltable.h.

std::map<Idx,std::string> faudes::SymbolTable::mNameMap [private]
 

Name lookup map.

Definition at line 242 of file symboltable.h.

Idx faudes::SymbolTable::mNextIndex [private]
 

Largest used index + 1.

Definition at line 248 of file symboltable.h.

SymbolTable faudes::SymbolTable::msEventSymbolTable [static, private]
 

static event symbol table (should go to faudes::vGenerator, or faudes)

Definition at line 251 of file symboltable.h.


The documentation for this class was generated from the following files:
Generated on Fri May 9 11:26:48 2008 for libFAUDES 2.09b by  doxygen 1.4.4