CBMC
designator.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: ANSI-C Language Type Checking
4
5
Author: Daniel Kroening, kroening@kroening.com
6
7
\*******************************************************************/
8
11
12
#ifndef CPROVER_ANSI_C_DESIGNATOR_H
13
#define CPROVER_ANSI_C_DESIGNATOR_H
14
15
#include <vector>
16
#include <iosfwd>
17
18
#include <
util/type.h
>
19
20
class
designatort
21
{
22
public
:
23
struct
entryt
24
{
25
size_t
index
;
26
size_t
size
;
27
bool
vla_permitted
;
28
typet
type
,
subtype
;
29
30
explicit
entryt
(
const
typet
&
type
):
31
index
(0),
size
(0),
vla_permitted
(false),
type
(
type
)
32
{
33
}
34
};
35
36
bool
empty
()
const
{
return
index_list
.empty(); }
37
size_t
size
()
const
{
return
index_list
.size(); }
38
const
entryt
&
operator[]
(
size_t
i)
const
{
return
index_list
[i]; }
39
entryt
&
operator[]
(
size_t
i) {
return
index_list
[i]; }
40
const
entryt
&
back
()
const
{
return
index_list
.back(); }
41
const
entryt
&
front
()
const
{
return
index_list
.front(); }
42
43
designatort
() { }
44
45
void
push_entry
(
const
entryt
&entry)
46
{
47
index_list
.push_back(entry);
48
}
49
50
void
pop_entry
()
51
{
52
index_list
.pop_back();
53
}
54
55
void
print
(std::ostream &out)
const
;
56
57
protected
:
58
// a list of indices into arrays or structs
59
typedef
std::vector<entryt>
index_listt
;
60
index_listt
index_list
;
61
};
62
63
inline
std::ostream &
operator <<
(std::ostream &os,
const
designatort
&d)
64
{
65
d.
print
(os);
66
return
os;
67
}
68
69
#endif
// CPROVER_ANSI_C_DESIGNATOR_H
designatort
Definition:
designator.h:21
designatort::front
const entryt & front() const
Definition:
designator.h:41
designatort::print
void print(std::ostream &out) const
Definition:
designator.cpp:16
designatort::index_list
index_listt index_list
Definition:
designator.h:60
designatort::operator[]
const entryt & operator[](size_t i) const
Definition:
designator.h:38
designatort::size
size_t size() const
Definition:
designator.h:37
designatort::push_entry
void push_entry(const entryt &entry)
Definition:
designator.h:45
designatort::back
const entryt & back() const
Definition:
designator.h:40
designatort::designatort
designatort()
Definition:
designator.h:43
designatort::empty
bool empty() const
Definition:
designator.h:36
designatort::pop_entry
void pop_entry()
Definition:
designator.h:50
designatort::operator[]
entryt & operator[](size_t i)
Definition:
designator.h:39
designatort::index_listt
std::vector< entryt > index_listt
Definition:
designator.h:59
typet
The type of an expression, extends irept.
Definition:
type.h:29
operator<<
std::ostream & operator<<(std::ostream &os, const designatort &d)
Definition:
designator.h:63
designatort::entryt
Definition:
designator.h:24
designatort::entryt::index
size_t index
Definition:
designator.h:25
designatort::entryt::size
size_t size
Definition:
designator.h:26
designatort::entryt::subtype
typet subtype
Definition:
designator.h:28
designatort::entryt::type
typet type
Definition:
designator.h:28
designatort::entryt::vla_permitted
bool vla_permitted
Definition:
designator.h:27
designatort::entryt::entryt
entryt(const typet &type)
Definition:
designator.h:30
type.h
Defines typet, type_with_subtypet and type_with_subtypest.
src
ansi-c
designator.h
Generated by
1.9.1