6 #ifndef CPROVER_UTIL_SYMBOL_TABLE_BASE_H 7 #define CPROVER_UTIL_SYMBOL_TABLE_BASE_H 10 #include <unordered_map> 24 typedef std::unordered_map<irep_idt, symbolt>
symbolst;
88 symbolst::const_iterator it =
symbols.find(name);
89 return it !=
symbols.end() ? &it->second :
nullptr;
113 if(symbol ==
nullptr)
114 throw std::out_of_range(
"name not found in symbol_table");
128 virtual std::pair<symbolt &, bool>
insert(
symbolt symbol) = 0;
134 virtual void erase(
const symbolst::const_iterator &entry) = 0;
135 virtual void clear() = 0;
137 void show(std::ostream &out)
const;
142 symbolst::iterator
it;
160 typedef symbolst::const_iterator::pointer
pointer;
166 return it != other.
it;
171 return it == other.
it;
220 virtual iteratort
begin() = 0;
221 virtual iteratort
end() = 0;
227 #endif // CPROVER_UTIL_SYMBOL_TABLE_BASE_H reference operator*() const
Dereference operator.
virtual void erase(const symbolst::const_iterator &entry)=0
Remove a symbol from the symbol table.
const symbolt & lookup_ref(const irep_idt &name) const
Find a symbol in the symbol table for read-only access.
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
void show(std::ostream &out) const
Print the contents of the symbol table.
std::ostream & operator<<(std::ostream &out, const symbol_table_baset &symbol_table)
Print the contents of the symbol table.
symbolst::iterator::difference_type difference_type
const symbol_base_mapt & symbol_base_map
std::multimap< irep_idt, irep_idt > symbol_base_mapt
symbolt & get_writeable_ref(const irep_idt &name)
Find a symbol in the symbol table for read-write access.
virtual symbolt * get_writeable(const irep_idt &name)=0
Find a symbol in the symbol table for read-write access.
bool operator==(const iteratort &other) const
symbolst::const_iterator::pointer pointer
symbolst::iterator::iterator_category iterator_category
virtual bool move(symbolt &symbol, symbolt *&new_symbol)=0
std::multimap< irep_idt, irep_idt > symbol_module_mapt
iteratort operator++(int)
Post-increment operator.
symbol_table_baset(const symbolst &symbols, const symbol_base_mapt &symbol_base_map, const symbol_module_mapt &symbol_module_map)
std::unordered_map< irep_idt, symbolt > symbolst
const symbol_module_mapt & symbol_module_map
symbolt & get_writeable_symbol()
Whereas the dereference operator gives a constant reference to the current symbol,...
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
virtual iteratort begin()=0
virtual iteratort end()=0
symbolst::const_iterator::value_type value_type
bool has_symbol(const irep_idt &name) const
Check whether a symbol exists in the symbol table.
symbolst::const_iterator::reference reference
iteratort(const iteratort &it, std::function< void(const irep_idt &id)> on_get_writeable)
virtual std::size_t next_unused_suffix(const std::string &prefix) const
symbol_table_baset & operator=(const symbol_table_baset &other)=delete
iteratort & operator++()
Preincrement operator Do not call on the end() iterator.
bool remove(const irep_idt &name)
Remove a symbol from the symbol table.
virtual ~symbol_table_baset()
Author: Diffblue Ltd.
The symbol table base class interface.
std::function< void(const irep_idt &id)> on_get_writeable
std::size_t next_unused_suffix(const std::string &prefix, std::size_t start_number) const
Find smallest unused integer i so that prefix + std::to_string(i) does not exist in the list symbols.
pointer operator->() const
Dereference operator (member access)
virtual std::pair< symbolt &, bool > insert(symbolt symbol)=0
Move or copy a new symbol to the symbol table.
bool add(const symbolt &symbol)
Add a new symbol to the symbol table.
virtual const symbol_tablet & get_symbol_table() const =0
bool operator!=(const iteratort &other) const
const symbolt * lookup(const irep_idt &name) const
Find a symbol in the symbol table for read-only access.
iteratort(symbolst::iterator it)