cprover
symbol_table.h
Go to the documentation of this file.
1 
5 
6 #ifndef CPROVER_UTIL_SYMBOL_TABLE_H
7 #define CPROVER_UTIL_SYMBOL_TABLE_H
8 
9 #include "symbol_table_base.h"
10 
11 #define forall_symbol_base_map(it, expr, base_name) \
12  for(symbol_base_mapt::const_iterator it=(expr).lower_bound(base_name), \
13  it_end=(expr).upper_bound(base_name); \
14  it!=it_end; ++it)
15 
16 
20 {
21 private:
25 
26 public:
32  {
33  }
34 
43  {
44  }
45 
47  {
48  // Copy to temp and then call move assignment
49  return *this=symbol_tablet(other);
50  }
51 
60  {
61  }
62 
64  {
65  internal_symbols = std::move(other.internal_symbols);
66  internal_symbol_base_map = std::move(other.internal_symbol_base_map);
67  internal_symbol_module_map = std::move(other.internal_symbol_module_map);
68  return *this;
69  }
70 
71  void swap(symbol_tablet &other)
72  {
76  }
77 
78 public:
79  virtual const symbol_tablet &get_symbol_table() const override
80  {
81  return *this;
82  }
83 
87  virtual symbolt *get_writeable(const irep_idt &name) override
88  {
89  symbolst::iterator it = internal_symbols.find(name);
90  return it != internal_symbols.end() ? &it->second : nullptr;
91  }
92 
93  virtual std::pair<symbolt &, bool> insert(symbolt symbol) override;
94  virtual bool move(symbolt &symbol, symbolt *&new_symbol) override;
95 
96  virtual void erase(const symbolst::const_iterator &entry) override;
97  virtual void clear() override
98  {
99  internal_symbols.clear();
100  internal_symbol_base_map.clear();
102  }
103 
104  virtual iteratort begin() override
105  {
106  return iteratort(internal_symbols.begin());
107  }
108  virtual iteratort end() override
109  {
110  return iteratort(internal_symbols.end());
111  }
112 };
113 
114 #endif // CPROVER_UTIL_SYMBOL_TABLE_H
symbolst internal_symbols
Definition: symbol_table.h:22
virtual void clear() override
Definition: symbol_table.h:97
std::multimap< irep_idt, irep_idt > symbol_base_mapt
virtual const symbol_tablet & get_symbol_table() const override
Definition: symbol_table.h:79
STL namespace.
Symbol table entry.This is a symbol in the symbol table, stored in an object of type symbol_tablet...
Definition: symbol.h:30
symbol_tablet & operator=(const symbol_tablet &other)
Definition: symbol_table.h:46
std::multimap< irep_idt, irep_idt > symbol_module_mapt
virtual symbolt * get_writeable(const irep_idt &name) override
Find a symbol in the symbol table for read-write access.
Definition: symbol_table.h:87
symbol_tablet(symbol_tablet &&other)
Definition: symbol_table.h:52
symbol_module_mapt internal_symbol_module_map
Definition: symbol_table.h:24
virtual bool move(symbolt &symbol, symbolt *&new_symbol) override
Move a symbol into the symbol table.
std::unordered_map< irep_idt, symbolt > symbolst
The symbol table.
Definition: symbol_table.h:19
virtual iteratort begin() override
Definition: symbol_table.h:104
virtual iteratort end() override
Definition: symbol_table.h:108
symbol_tablet & operator=(symbol_tablet &&other)
Definition: symbol_table.h:63
dstringt has one field, an unsigned integer no which is an index into a static table of strings...
Definition: dstring.h:33
virtual void erase(const symbolst::const_iterator &entry) override
Remove a symbol from the symbol table.
symbol_base_mapt internal_symbol_base_map
Definition: symbol_table.h:23
Author: Diffblue Ltd.
The symbol table base class interface.
symbol_tablet(const symbol_tablet &other)
Definition: symbol_table.h:35
void swap(symbol_tablet &other)
Definition: symbol_table.h:71
virtual std::pair< symbolt &, bool > insert(symbolt symbol) override
Author: Diffblue Ltd.