#include <SymbolMap.hh>
Public Member Functions | |
SymbolMap () | |
void | write (FILE *file) const |
Write symbol map in a file assuming that S = std::string. | |
void | read (FILE *file) |
Read symbol map from a file assuming that S = std::string. | |
I | insert_dummy (const S &symbol=S()) |
Insert a dummy index that does not have any mapping from symbol to index. | |
I | insert (const S &symbol) |
Insert a symbol to the map but only if it does not exist yet. | |
I | insert_new (const S &symbol) |
Insert a symbol to the map raising an error if the symbol exists already. | |
I | index (const S &symbol) const |
Return the index of the symbol raising an error if the symbol does not exist. | |
I | index_nothrow (const S &symbol) const |
Return the index of the symbol returning negative if symbol does not exist. | |
const S & | at (I index) const |
Return the symbol with the given index. | |
S & | at (I index) |
Return the symbol with the given index. | |
I | size () const |
Return the size of the map. | |
Private Types | |
typedef std::map< S, I > | Map |
Private Attributes | |
std::vector< S > | m_symbols |
Symbols in the map. | |
Map | m_indices |
Indices of the symbols. |
|
|
|
|
|
Return the symbol with the given index.
|
|
Return the symbol with the given index.
|
|
Return the index of the symbol raising an error if the symbol does not exist.
|
|
Return the index of the symbol returning negative if symbol does not exist.
|
|
Insert a symbol to the map but only if it does not exist yet. Use insert_new() if reinsert should raise error.
|
|
Insert a dummy index that does not have any mapping from symbol to index.
|
|
Insert a symbol to the map raising an error if the symbol exists already.
|
|
Read symbol map from a file assuming that S = std::string.
|
|
Return the size of the map.
|
|
Write symbol map in a file assuming that S = std::string.
|
|
Indices of the symbols.
|
|
Symbols in the map.
|