CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
abstract_object_set.h
Go to the documentation of this file.
1/*******************************************************************\
2
3 Module: analyses variable-sensitivity
4
5 Author: Jez Higgins, jez@jezuk.co.uk
6
7\*******************************************************************/
8
11
12#ifndef CBMC_ABSTRACT_OBJECT_SET_H
13#define CBMC_ABSTRACT_OBJECT_SET_H
14
16#include <unordered_set>
17
19{
20public:
21 using value_sett = std::unordered_set<
25 using const_iterator = value_sett::const_iterator;
26 using value_type = value_sett::value_type;
27 using size_type = value_sett::size_type;
28
30 {
31 values.insert(o);
32 }
34 {
35 values.insert(std::move(o));
36 }
38 {
39 values.insert(rhs.begin(), rhs.end());
40 }
41 void insert(const value_ranget &rhs)
42 {
43 for(auto const &value : rhs)
44 insert(value);
45 }
46
48 {
49 // alias for insert so we can use back_inserter
50 values.insert(v);
51 }
52
54 {
55 return *begin();
56 }
57
59 {
60 return values.begin();
61 }
63 {
64 return values.end();
65 }
66
67 value_sett::size_type size() const
68 {
69 return values.size();
70 }
71 bool empty() const
72 {
73 return values.empty();
74 }
75
76 bool operator==(const abstract_object_sett &rhs) const
77 {
78 return values == rhs.values;
79 }
80
81 void clear()
82 {
83 values.clear();
84 }
85
86 void
87 output(std::ostream &out, const ai_baset &ai, const namespacet &ns) const;
88
92
93private:
95};
96
98{
99public:
100 virtual const abstract_object_sett &get_values() const = 0;
101};
102
103#endif //CBMC_ABSTRACT_OBJECT_SET_H
sharing_ptrt< class abstract_objectt > abstract_object_pointert
Common behaviour for abstract objects modelling values - constants, intervals, etc.
void insert(const abstract_object_sett &rhs)
value_sett::size_type size_type
const_iterator begin() const
value_sett::size_type size() const
void insert(const value_ranget &rhs)
value_sett::value_type value_type
void output(std::ostream &out, const ai_baset &ai, const namespacet &ns) const
void insert(const abstract_object_pointert &o)
value_sett::const_iterator const_iterator
abstract_object_pointert first() const
std::unordered_set< abstract_object_pointert, abstract_hashert, abstract_equalert > value_sett
void insert(abstract_object_pointert &&o)
const_iterator end() const
void push_back(const abstract_object_pointert &v)
bool operator==(const abstract_object_sett &rhs) const
constant_interval_exprt to_interval() const
Calculate the set of values as an interval.
This is the basic interface of the abstract interpreter with default implementations of the core func...
Definition ai.h:117
virtual void clear()
Reset the abstract state.
Definition ai.h:265
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
Represents an interval of values.
Definition interval.h:52
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition namespace.h:91
virtual const abstract_object_sett & get_values() const =0