clingo
|
Symbol table that maps external ids to internal literals. More...
#include <literal.h>
Classes | |
struct | symbol_type |
Public Types | |
enum | MapType { map_direct, map_indirect } |
typedef uint32 | key_type |
typedef String | data_type |
typedef std::pair< key_type, symbol_type > | value_type |
typedef PodVector< value_type > ::type | map_type |
typedef map_type::const_iterator | const_iterator |
Public Member Functions | |
SymbolTable () | |
Creates an empty symbol table. More... | |
~SymbolTable () | |
void | copyTo (SymbolTable &o) |
MapType | type () const |
Type of symbol mapping. More... | |
uint32 | size () const |
Returns the number of symbols in this table. More... | |
const_iterator | begin () const |
Returns an iterator pointing to the beginning of this index. More... | |
const_iterator | curBegin () const |
Returns an iterator pointing to the first atom of the current incremental step. More... | |
const_iterator | end () const |
Returns an iterator pointing behind the end of this index. More... | |
const symbol_type * | find (key_type i) const |
Returns the symbol with id i or 0 if no such symbol exists (yet). More... | |
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. More... | |
void | clear () |
Removes all symbols from this table. More... | |
void | startInit () |
Prepares the symbol table so that new symbols can be added. More... | |
symbol_type & | addUnique (key_type id, const char *name) |
Adds the symbol with the given id to the symbol table. More... | |
void | endInit (MapType type=map_indirect, Var end=varMax) |
Freezes the symbol table and prepares it so that lookup operations become valid. More... | |
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:
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 |
|
inline |
Creates an empty symbol table.
|
inline |
|
inline |
Adds the symbol with the given id to the symbol table.
|
inline |
Returns an iterator pointing to the beginning of this index.
|
inline |
Removes all symbols from this table.
|
inline |
|
inline |
Returns an iterator pointing to the first atom of the current incremental step.
|
inline |
Returns an iterator pointing behind the end of this index.
|
inline |
Freezes the symbol table and prepares it so that lookup operations become valid.
|
inline |
Returns the symbol with id i or 0 if no such symbol exists (yet).
|
inline |
|
inline |
Returns the symbol with the given id.
|
inline |
Returns the number of symbols in this table.
|
inline |
Prepares the symbol table so that new symbols can be added.
|
inline |
Type of symbol mapping.
In a direct mapping, symbol ids directly correspond to solver variables. In an indirect mapping, symbol ids are independent of solver variables and are instead mapped to solver literals.