@@ -131,6 +131,95 @@ class symbol_exprt:public exprt
131
131
}
132
132
};
133
133
134
+ /* ! \brief Cast a generic exprt to a \ref symbol_exprt
135
+ *
136
+ * This is an unchecked conversion. \a expr must be known to be \ref
137
+ * symbol_exprt.
138
+ *
139
+ * \param expr Source expression
140
+ * \return Object of type \ref symbol_exprt
141
+ *
142
+ * \ingroup gr_std_expr
143
+ */
144
+ inline const symbol_exprt &to_symbol_expr (const exprt &expr)
145
+ {
146
+ PRECONDITION (expr.id ()==ID_symbol);
147
+ DATA_INVARIANT (!expr.has_operands (), " Symbols must not have operands" );
148
+ return static_cast <const symbol_exprt &>(expr);
149
+ }
150
+
151
+ /* ! \copydoc to_symbol_expr(const exprt &)
152
+ * \ingroup gr_std_expr
153
+ */
154
+ inline symbol_exprt &to_symbol_expr (exprt &expr)
155
+ {
156
+ PRECONDITION (expr.id ()==ID_symbol);
157
+ DATA_INVARIANT (!expr.has_operands (), " Symbols must not have operands" );
158
+ return static_cast <symbol_exprt &>(expr);
159
+ }
160
+
161
+ template <> inline bool can_cast_expr<symbol_exprt>(const exprt &base)
162
+ {
163
+ return base.id ()==ID_symbol;
164
+ }
165
+ inline void validate_expr (const symbol_exprt &value)
166
+ {
167
+ validate_operands (value, 0 , " Symbols must not have operands" );
168
+ }
169
+
170
+ /* ! \brief Expression to hold a "next state" symbol (variable)
171
+ */
172
+ class next_symbol_exprt :public symbol_exprt
173
+ {
174
+ public:
175
+ /* ! \brief Constructor
176
+ * \param identifier Name of symbol
177
+ * \param type Type of symbol
178
+ */
179
+ next_symbol_exprt (
180
+ const irep_idt &identifier,
181
+ const typet &type):symbol_exprt(identifier, type)
182
+ {
183
+ id (ID_next_symbol);
184
+ }
185
+ };
186
+
187
+ /* ! \brief Cast a generic exprt to a \ref next_symbol_exprt
188
+ *
189
+ * This is an unchecked conversion. \a expr must be known to be \ref
190
+ * next_symbol_exprt.
191
+ *
192
+ * \param expr Source expression
193
+ * \return Object of type \ref next_symbol_exprt
194
+ *
195
+ * \ingroup gr_std_expr
196
+ */
197
+ inline const next_symbol_exprt &to_next_symbol_expr (const exprt &expr)
198
+ {
199
+ PRECONDITION (expr.id ()==ID_next_symbol);
200
+ DATA_INVARIANT (!expr.has_operands (), " Symbols must not have operands" );
201
+ return static_cast <const next_symbol_exprt &>(expr);
202
+ }
203
+
204
+ /* ! \copydoc to_next_symbol_expr(const exprt &)
205
+ * \ingroup gr_std_expr
206
+ */
207
+ inline next_symbol_exprt &to_next_symbol_expr (exprt &expr)
208
+ {
209
+ PRECONDITION (expr.id ()==ID_next_symbol);
210
+ DATA_INVARIANT (!expr.has_operands (), " Symbols must not have operands" );
211
+ return static_cast <next_symbol_exprt &>(expr);
212
+ }
213
+
214
+ template <> inline bool can_cast_expr<next_symbol_exprt>(const exprt &base)
215
+ {
216
+ return base.id ()==ID_next_symbol;
217
+ }
218
+ inline void validate_expr (const next_symbol_exprt &value)
219
+ {
220
+ validate_operands (value, 0 , " Symbols must not have operands" );
221
+ }
222
+
134
223
/* ! \brief Expression to hold a symbol (variable)
135
224
*/
136
225
class decorated_symbol_exprt :public symbol_exprt
@@ -197,41 +286,6 @@ class decorated_symbol_exprt:public symbol_exprt
197
286
}
198
287
};
199
288
200
- /* ! \brief Cast a generic exprt to a \ref symbol_exprt
201
- *
202
- * This is an unchecked conversion. \a expr must be known to be \ref
203
- * symbol_exprt.
204
- *
205
- * \param expr Source expression
206
- * \return Object of type \ref symbol_exprt
207
- *
208
- * \ingroup gr_std_expr
209
- */
210
- inline const symbol_exprt &to_symbol_expr (const exprt &expr)
211
- {
212
- PRECONDITION (expr.id ()==ID_symbol);
213
- DATA_INVARIANT (!expr.has_operands (), " Symbols must not have operands" );
214
- return static_cast <const symbol_exprt &>(expr);
215
- }
216
-
217
- /* ! \copydoc to_symbol_expr(const exprt &)
218
- * \ingroup gr_std_expr
219
- */
220
- inline symbol_exprt &to_symbol_expr (exprt &expr)
221
- {
222
- PRECONDITION (expr.id ()==ID_symbol);
223
- DATA_INVARIANT (!expr.has_operands (), " Symbols must not have operands" );
224
- return static_cast <symbol_exprt &>(expr);
225
- }
226
-
227
- template <> inline bool can_cast_expr<symbol_exprt>(const exprt &base)
228
- {
229
- return base.id ()==ID_symbol;
230
- }
231
- inline void validate_expr (const symbol_exprt &value)
232
- {
233
- validate_operands (value, 0 , " Symbols must not have operands" );
234
- }
235
289
236
290
237
291
/* ! \brief Expression to hold a nondeterministic choice
0 commit comments