1#ifndef CPROVER_CONTEXT_H
2#define CPROVER_CONTEXT_H
6#include <boost/multi_index/hashed_index.hpp>
7#include <boost/multi_index/member.hpp>
8#include <boost/multi_index/sequenced_index.hpp>
9#include <boost/multi_index_container.hpp>
45typedef boost::multi_index_container<
47 boost::multi_index::indexed_by<
48 boost::multi_index::hashed_unique<
49 boost::multi_index::tag<by_id>,
52 boost::multi_index::sequenced<boost::multi_index::tag<by_order>>>>
58 typedef std::function<void(
const symbolt &symbol)> const_symbol_delegate;
59 typedef std::function<void(
symbolt &symbol)> symbol_delegate;
69#ifdef ENABLE_OLD_FRONTEND
98 return move(symbol, new_symbol);
111 symbols.swap(
other.symbols);
147 template <
typename T>
151 if (s.name == base_name)
156 template <
typename T>
159 const_symbol_delegate wrapped(std::cref(t));
160 foreach_operand_impl_in_order_const(wrapped);
163 template <
typename T>
166 symbol_delegate wrapped(std::ref(t));
167 foreach_operand_impl_in_order(wrapped);
170 template <
typename T>
173 const_symbol_delegate wrapped(std::cref(t));
174 foreach_operand_impl_const(wrapped);
177 template <
typename T>
180 symbol_delegate wrapped(std::ref(t));
181 foreach_operand_impl(wrapped);
186 return symbols.size();
192 void foreach_operand_impl_const(const_symbol_delegate &expr)
const;
193 void foreach_operand_impl(symbol_delegate &expr);
195 void foreach_operand_impl_in_order_const(const_symbol_delegate &expr)
const;
196 void foreach_operand_impl_in_order(symbol_delegate &expr);
void Foreach_operand(T &&t)
Definition context.h:178
symbolt * find_symbol(const char *name)
Definition context.h:114
contextt()
Definition context.h:62
contextt & operator=(const contextt &rhs)=delete
DUMP_METHOD void dump() const
Definition context.cpp:40
void Foreach_operand_in_order(T &&t)
Definition context.h:164
symbolt * reorder_symbol_to_back(irep_idt name)
Move the symbol with id name to the end of the insertion-order view, keeping it in the table.
Definition context.cpp:107
bool add(const symbolt &symbol)
Definition context.cpp:10
bool move(symbolt &symbol, symbolt *&new_symbol)
Definition context.cpp:18
void erase_since(irep_idt point)
Erase every symbol added after point (in insertion order, as returned by mark()).
Definition context.cpp:85
void erase_symbol(irep_idt name)
Definition context.cpp:65
contextt & operator=(contextt &&) noexcept=default
void foreach_operand(T &&t) const
Definition context.h:171
contextt(contextt &&) noexcept=default
contextt(const contextt &obj)=delete
void clear()
Definition context.h:102
unsigned int size() const
Definition context.h:184
void foreach_operand_in_order(T &&t) const
Definition context.h:157
symbolt * move_symbol_to_context(symbolt &symbol)
Definition context.cpp:158
void swap(contextt &other)
Definition context.h:109
irep_idt mark() const
Id of the most-recently-added symbol, or a nil id if the table is empty.
Definition context.cpp:79
void foreach_named_symbol_with_base(irep_idt base_name, T &&t) const
Invoke t(id) for every symbol whose base name equals base_name, in insertion order (the former forall...
Definition context.h:148
#define DUMP_METHOD
Definition compiler_defs.h:97
@ other
Definition converter_compare.cpp:887
#define T
Definition exp2f.c:24
std::hash< irep_idt > irep_id_hash
Definition irep.h:15
#define log_error(fmt,...)
Definition message.h:83
boost::multi_index_container< symbolt, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::tag< by_id >, BOOST_MULTI_INDEX_MEMBER(symbolt, irep_idt, id), irep_id_hash >, boost::multi_index::sequenced< boost::multi_index::tag< by_order > > > > symbol_containert
Definition context.h:53