1 /* Grid::Status class implementation: inline functions.
2 Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3 Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4
5 This file is part of the Parma Polyhedra Library (PPL).
6
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23
24 #ifndef PPL_Grid_Status_inlines_hh
25 #define PPL_Grid_Status_inlines_hh 1
26
27 namespace Parma_Polyhedra_Library {
28
29 inline
Status(flags_t mask)30 Grid::Status::Status(flags_t mask)
31 : flags(mask) {
32 }
33
34 inline
Status()35 Grid::Status::Status()
36 : flags(ZERO_DIM_UNIV) {
37 }
38
39 inline bool
test_all(flags_t mask) const40 Grid::Status::test_all(flags_t mask) const {
41 return (flags & mask) == mask;
42 }
43
44 inline bool
test_any(flags_t mask) const45 Grid::Status::test_any(flags_t mask) const {
46 return (flags & mask) != 0;
47 }
48
49 inline void
set(flags_t mask)50 Grid::Status::set(flags_t mask) {
51 flags |= mask;
52 }
53
54 inline void
reset(flags_t mask)55 Grid::Status::reset(flags_t mask) {
56 flags &= ~mask;
57 }
58
59 inline bool
test_zero_dim_univ() const60 Grid::Status::test_zero_dim_univ() const {
61 return flags == ZERO_DIM_UNIV;
62 }
63
64 inline void
reset_zero_dim_univ()65 Grid::Status::reset_zero_dim_univ() {
66 // This is a no-op if the current status is not zero-dim.
67 if (flags == ZERO_DIM_UNIV) {
68 // In the zero-dim space, if it is not the universe it is empty.
69 flags = EMPTY;
70 }
71 }
72
73 inline void
set_zero_dim_univ()74 Grid::Status::set_zero_dim_univ() {
75 // Zero-dim universe is incompatible with anything else.
76 flags = ZERO_DIM_UNIV;
77 }
78
79 inline bool
test_empty() const80 Grid::Status::test_empty() const {
81 return test_any(EMPTY);
82 }
83
84 inline void
reset_empty()85 Grid::Status::reset_empty() {
86 reset(EMPTY);
87 }
88
89 inline void
set_empty()90 Grid::Status::set_empty() {
91 flags = EMPTY;
92 }
93
94 inline bool
test_c_up_to_date() const95 Grid::Status::test_c_up_to_date() const {
96 return test_any(C_UP_TO_DATE);
97 }
98
99 inline void
reset_c_up_to_date()100 Grid::Status::reset_c_up_to_date() {
101 reset(C_UP_TO_DATE);
102 }
103
104 inline void
set_c_up_to_date()105 Grid::Status::set_c_up_to_date() {
106 set(C_UP_TO_DATE);
107 }
108
109 inline bool
test_g_up_to_date() const110 Grid::Status::test_g_up_to_date() const {
111 return test_any(G_UP_TO_DATE);
112 }
113
114 inline void
reset_g_up_to_date()115 Grid::Status::reset_g_up_to_date() {
116 reset(G_UP_TO_DATE);
117 }
118
119 inline void
set_g_up_to_date()120 Grid::Status::set_g_up_to_date() {
121 set(G_UP_TO_DATE);
122 }
123
124 inline bool
test_c_minimized() const125 Grid::Status::test_c_minimized() const {
126 return test_any(C_MINIMIZED);
127 }
128
129 inline void
reset_c_minimized()130 Grid::Status::reset_c_minimized() {
131 reset(C_MINIMIZED);
132 }
133
134 inline void
set_c_minimized()135 Grid::Status::set_c_minimized() {
136 set(C_MINIMIZED);
137 }
138
139 inline bool
test_g_minimized() const140 Grid::Status::test_g_minimized() const {
141 return test_any(G_MINIMIZED);
142 }
143
144 inline void
reset_g_minimized()145 Grid::Status::reset_g_minimized() {
146 reset(G_MINIMIZED);
147 }
148
149 inline void
set_g_minimized()150 Grid::Status::set_g_minimized() {
151 set(G_MINIMIZED);
152 }
153
154
155 inline bool
test_c_pending() const156 Grid::Status::test_c_pending() const {
157 return test_any(CS_PENDING);
158 }
159
160 inline void
reset_c_pending()161 Grid::Status::reset_c_pending() {
162 reset(CS_PENDING);
163 }
164
165 inline void
set_c_pending()166 Grid::Status::set_c_pending() {
167 set(CS_PENDING);
168 }
169
170 inline bool
test_g_pending() const171 Grid::Status::test_g_pending() const {
172 return test_any(GS_PENDING);
173 }
174
175 inline void
reset_g_pending()176 Grid::Status::reset_g_pending() {
177 reset(GS_PENDING);
178 }
179
180 inline void
set_g_pending()181 Grid::Status::set_g_pending() {
182 set(GS_PENDING);
183 }
184
185
186 inline bool
test_sat_c_up_to_date() const187 Grid::Status::test_sat_c_up_to_date() const {
188 return test_any(SAT_C_UP_TO_DATE);
189 }
190
191 inline void
reset_sat_c_up_to_date()192 Grid::Status::reset_sat_c_up_to_date() {
193 reset(SAT_C_UP_TO_DATE);
194 }
195
196 inline void
set_sat_c_up_to_date()197 Grid::Status::set_sat_c_up_to_date() {
198 set(SAT_C_UP_TO_DATE);
199 }
200
201 inline bool
test_sat_g_up_to_date() const202 Grid::Status::test_sat_g_up_to_date() const {
203 return test_any(SAT_G_UP_TO_DATE);
204 }
205
206 inline void
reset_sat_g_up_to_date()207 Grid::Status::reset_sat_g_up_to_date() {
208 reset(SAT_G_UP_TO_DATE);
209 }
210
211 inline void
set_sat_g_up_to_date()212 Grid::Status::set_sat_g_up_to_date() {
213 set(SAT_G_UP_TO_DATE);
214 }
215
216 } // namespace Parma_Polyhedra_Library
217
218 #endif // !defined(PPL_Status_inlines_hh)
219