6 #ifndef CPROVER_UTIL_JOURNALLING_SYMBOL_TABLE_H 7 #define CPROVER_UTIL_JOURNALLING_SYMBOL_TABLE_H 10 #include <unordered_set> 37 typedef std::unordered_set<irep_idt> changesett;
52 base_symbol_table.symbols,
53 base_symbol_table.symbol_base_map,
54 base_symbol_table.symbol_module_map),
55 base_symbol_table(base_symbol_table)
60 journalling_symbol_tablet(
const journalling_symbol_tablet &other) =
delete;
62 journalling_symbol_tablet(journalling_symbol_tablet &&other)
65 other.symbol_base_map,
66 other.symbol_module_map),
67 base_symbol_table(other.base_symbol_table),
68 inserted(
std::move(other.inserted)),
69 updated(
std::move(other.updated)),
70 removed(
std::move(other.removed))
81 return journalling_symbol_tablet(base_symbol_table);
86 bool ret = base_symbol_table.
move(symbol, new_symbol);
88 on_insert(symbol.
name);
90 on_update(symbol.
name);
98 on_update(identifier);
102 virtual std::pair<symbolt &, bool>
insert(
symbolt symbol)
override 104 std::pair<symbolt &, bool> result =
105 base_symbol_table.
insert(std::move(symbol));
107 on_insert(result.first.name);
112 erase(
const symbol_tablet::symbolst::const_iterator &entry)
override 114 const irep_idt entry_name = entry->first;
115 base_symbol_table.
erase(entry);
116 on_remove(entry_name);
119 virtual void clear()
override 121 for(
const auto &named_symbol : base_symbol_table.
symbols)
122 on_remove(named_symbol.first);
123 base_symbol_table.
clear();
126 virtual iteratort
begin()
override 129 base_symbol_table.
begin(), [
this](
const irep_idt &id) { on_update(
id); });
131 virtual iteratort
end()
override 134 base_symbol_table.
end(), [
this](
const irep_idt &id) { on_update(
id); });
137 const changesett &get_inserted()
const 141 const changesett &get_updated()
const 145 const changesett &get_removed()
const 153 if(removed.erase(
id) == 0)
165 if(inserted.erase(
id) == 0)
171 #endif // CPROVER_UTIL_JOURNALLING_SYMBOL_TABLE_H irep_idt name
The unique identifier.
virtual void erase(const symbolst::const_iterator &entry)=0
Remove a symbol from the symbol table.
virtual symbolt * get_writeable(const irep_idt &name)=0
Find a symbol in the symbol table for read-write access.
Symbol table entry.This is a symbol in the symbol table, stored in an object of type symbol_tablet...
virtual bool move(symbolt &symbol, symbolt *&new_symbol)=0
virtual iteratort begin()=0
virtual iteratort end()=0
The symbol table base class interface.
virtual std::pair< symbolt &, bool > insert(symbolt symbol)=0
Move or copy a new symbol to the symbol table.
virtual const symbol_tablet & get_symbol_table() const =0