Symbol table that maps external ids to internal literals. More...
#include <literal.h>
Classes | |
| struct | LessKey |
| struct | String |
| struct | symbol_type |
Public Types | |
| typedef map_type::const_iterator | const_iterator |
| typedef String | data_type |
| typedef uint32 | key_type |
| typedef PodVector< value_type > ::type | map_type |
| enum | MapType { map_direct, map_indirect } |
| typedef std::pair< key_type, symbol_type > | value_type |
Public Member Functions | |
| symbol_type & | addUnique (key_type id, const char *name) |
| Adds the symbol with the given id to the symbol table. | |
| const_iterator | begin () const |
| Returns an iterator pointing to the beginning of this index. | |
| void | clear () |
| Removes all symbols from this table. | |
| void | copyTo (SymbolTable &o) |
| const_iterator | curBegin () const |
| Returns an iterator pointing to the first atom of the current incremental step. | |
| const_iterator | end () const |
| Returns an iterator pointing behind the end of this index. | |
| void | endInit (MapType type=map_indirect, Var end=varMax) |
| Freezes the symbol table and prepares it so that lookup operations become valid. | |
| const symbol_type * | find (key_type i) const |
| Returns the symbol with id i or 0 if no such symbol exists (yet). | |
| const_iterator | lower_bound (const_iterator start, key_type i) const |
| const symbol_type & | operator[] (key_type id) const |
| Returns the symbol with the given id. | |
| uint32 | size () const |
| Returns the number of symbols in this table. | |
| void | startInit () |
| Prepares the symbol table so that new symbols can be added. | |
| SymbolTable () | |
| Creates an empty symbol table. | |
| MapType | type () const |
| Type of symbol mapping. | |
| ~SymbolTable () | |
Private Member Functions | |
| const char * | dupName (const char *n) const |
| void | freeName (const char *n) const |
| SymbolTable & | operator= (const SymbolTable &) |
| SymbolTable (const SymbolTable &) | |
| bool | unique () const |
Private Attributes | |
| uint32 | end_ |
| map_type::size_type | lastSort_ |
| map_type::size_type | lastStart_ |
| map_type | map_ |
| MapType | type_ |
Symbol table that maps external ids to internal literals.
A symbol table can be populated incrementally, but each incremental step must be started with a call to startInit() and stopped with a call to endInit(). New symbols only become visible once endInit() was called.
The following invariants must hold but are not fully checked: 1. Symbol ids are added at most once 2. All Ids added in step I+1 are greater than those added in step I
| typedef map_type::const_iterator Clasp::SymbolTable::const_iterator |
| typedef String Clasp::SymbolTable::data_type |
| typedef uint32 Clasp::SymbolTable::key_type |
| typedef PodVector<value_type>::type Clasp::SymbolTable::map_type |
| typedef std::pair<key_type, symbol_type> Clasp::SymbolTable::value_type |
| Clasp::SymbolTable::SymbolTable | ( | ) | [inline] |
| Clasp::SymbolTable::~SymbolTable | ( | ) | [inline] |
| Clasp::SymbolTable::SymbolTable | ( | const SymbolTable & | ) | [private] |
| symbol_type& Clasp::SymbolTable::addUnique | ( | key_type | id, |
| const char * | name | ||
| ) | [inline] |
Adds the symbol with the given id to the symbol table.
| const_iterator Clasp::SymbolTable::begin | ( | ) | const [inline] |
| void Clasp::SymbolTable::clear | ( | ) | [inline] |
| void Clasp::SymbolTable::copyTo | ( | SymbolTable & | o | ) | [inline] |
| const_iterator Clasp::SymbolTable::curBegin | ( | ) | const [inline] |
| const char* Clasp::SymbolTable::dupName | ( | const char * | n | ) | const [inline, private] |
| const_iterator Clasp::SymbolTable::end | ( | ) | const [inline] |
| void Clasp::SymbolTable::endInit | ( | MapType | type = map_indirect, |
| Var | end = varMax |
||
| ) | [inline] |
| const symbol_type* Clasp::SymbolTable::find | ( | key_type | i | ) | const [inline] |
| void Clasp::SymbolTable::freeName | ( | const char * | n | ) | const [inline, private] |
| const_iterator Clasp::SymbolTable::lower_bound | ( | const_iterator | start, |
| key_type | i | ||
| ) | const [inline] |
| SymbolTable& Clasp::SymbolTable::operator= | ( | const SymbolTable & | ) | [private] |
| const symbol_type& Clasp::SymbolTable::operator[] | ( | key_type | id | ) | const [inline] |
| uint32 Clasp::SymbolTable::size | ( | ) | const [inline] |
| void Clasp::SymbolTable::startInit | ( | ) | [inline] |
| MapType Clasp::SymbolTable::type | ( | ) | const [inline] |
| bool Clasp::SymbolTable::unique | ( | ) | const [inline, private] |
uint32 Clasp::SymbolTable::end_ [private] |
map_type::size_type Clasp::SymbolTable::lastSort_ [private] |
map_type::size_type Clasp::SymbolTable::lastStart_ [private] |
map_type Clasp::SymbolTable::map_ [private] |
MapType Clasp::SymbolTable::type_ [private] |