APRONXX  0.9.12
/builddir/build/BUILD/apron-0.9.12/apronxx/apxx_tcons1.hh
Go to the documentation of this file.
1 /* -*- C++ -*-
2  * apxx_tcons1.hh
3  *
4  * APRON Library / C++ class wrappers
5  *
6  * Copyright (C) Antoine Mine' 2007
7  *
8  */
9 /* This file is part of the APRON Library, released under LGPL license
10  with an exception allowing the redistribution of statically linked
11  executables.
12 
13  Please read the COPYING file packaged in the distribution.
14 */
15 
16 #ifndef __APXX_TCONS1_HH
17 #define __APXX_TCONS1_HH
18 
19 #include "ap_tcons1.h"
20 #include "apxx_tcons0.hh"
21 #include "apxx_texpr1.hh"
22 
23 
24 namespace apron {
25 
26 
27 /* ================================= */
28 /* tcons1 */
29 /* ================================= */
30 
31 
39 class tcons1 : public use_malloc {
40 
41 protected:
42 
43  ap_tcons1_t l;
44 
46  tcons1(ap_tcons1_t l);
47 
48  friend class abstract0;
49  friend class tcons1_array;
50 
51 public:
52 
53 
54  /* constructors */
55  /* ============ */
56 
59 
66  tcons1(const environment& env, ap_constyp_t constyp=AP_CONS_SUPEQ);
67 
73  tcons1(ap_constyp_t constyp, const texpr1::builder& t);
74 
79  tcons1(ap_constyp_t constyp, const texpr1::builder& t, const scalar& modulo);
80 
82  tcons1(const tcons1& x);
83 
84 
89  tcons1(const tcons1& x, const environment& e);
90 
92  tcons1(const environment& e, unsat x);
93 
98  tcons1(const lincons1& x);
99 
100 
102 
103  /* destructor */
104  /* ========== */
105 
108 
110  ~tcons1();
111 
113 
114  /* 'Intelligent' constructors */
115  /* ========================== */
116 
119 
121  friend tcons1 operator>=(const texpr1::builder& a, const texpr1::builder& b);
122 
124  friend tcons1 operator<=(const texpr1::builder& a, const texpr1::builder& b);
125 
127  friend tcons1 operator> (const texpr1::builder& a, const texpr1::builder& b);
128 
130  friend tcons1 operator< (const texpr1::builder& a, const texpr1::builder& b);
131 
133  friend tcons1 operator==(const texpr1::builder& a, const texpr1::builder& b);
134 
136  friend tcons1 operator!=(const texpr1::builder& a, const texpr1::builder& b);
137 
139 
140  /* assignment */
141  /* ========== */
142 
145 
147  tcons1& operator= (const tcons1& x);
148 
150  tcons1& operator= (unsat x);
151 
156  tcons1& operator= (const lincons1& x);
157 
163  void set_modulo(const scalar& c);
164 
170  void set_texpr(const texpr1::builder& c);
171 
173 
174 
175  /* dimension operations */
176  /* ==================== */
177 
180 
185  void extend_environment(const environment& e);
186 
188 
189 
190  /* access */
191  /* ====== */
192 
195 
196  /* get */
197 
200 
202  const tcons0& get_tcons0() const;
203 
205  tcons0& get_tcons0();
206 
211  ap_constyp_t& get_constyp();
212 
217  const ap_constyp_t& get_constyp() const;
218 
220  bool has_modulo() const;
221 
223  bool has_texpr() const;
224 
229  scalar& get_modulo();
230 
235  const scalar& get_modulo() const;
236 
242 
248 
250 
251 
252  /* print */
253  /* ===== */
254 
257 
263  friend std::ostream& operator<< (std::ostream& os, const tcons1& s);
264 
266  void print(FILE* stream=stdout) const;
267 
269 
270  /* tests */
271  /* ===== */
272 
275 
280  bool is_interval_cst() const;
281 
286  bool is_interval_linear() const;
287 
292  bool is_interval_polynomial() const;
293 
298  bool is_interval_polyfrac() const;
299 
304  bool is_scalar() const;
305 
307 
308 
309  /* C-level compatibility */
310  /* ===================== */
311 
314 
316  const ap_tcons1_t* get_ap_tcons1_t() const;
317 
319  ap_tcons1_t* get_ap_tcons1_t();
320 
322 
323 };
324 
325 
326 
327 /* ================================= */
328 /* tcons1_array */
329 /* ================================= */
330 
331 
337 class tcons1_array : public use_malloc {
338 
339 protected:
340 
341  ap_tcons1_array_t a;
342 
344  tcons1_array(ap_tcons1_array_t& a);
345 
346  friend class abstract0;
347  friend class abstract1;
348 
349 public:
350 
351  /* constructors */
352  /* ============ */
353 
356 
360  tcons1_array(const environment& e, const tcons0_array& x);
361 
366  tcons1_array(const environment& e, size_t size);
367 
369  tcons1_array(const tcons1_array& x);
370 
375  tcons1_array(const tcons1_array& x, const environment& e);
376 
377 
383  tcons1_array(size_t size, const tcons1 x[]);
384 
390  tcons1_array(const std::vector<tcons1>& x);
391 
393 
394 
395  /* destructor */
396  /* ========== */
397 
400 
402  ~tcons1_array();
403 
405 
406 
407  /* assignment */
408  /* ========== */
409 
412 
415 
421  tcons1_array& operator= (const tcons1 x[]);
422 
427  tcons1_array& operator= (const std::vector<tcons1>& x);
428 
430 
431 
432  /* dimension operations */
433  /* ==================== */
434 
437 
439  void resize(size_t size);
440 
445  void extend_environment(const environment& e);
446 
448 
449 
450  /* access */
451  /* ====== */
452 
455 
457  size_t size() const;
458 
461 
463  const tcons0_array& get_tcons0_array() const;
464 
467 
472  tcons1 get(size_t i) const;
473 
479  void set(size_t i, const tcons1& x);
480 
482 
483 
484  /* conversion */
485  /* ========== */
486 
489 
491  operator std::vector<tcons1>() const;
492 
494 
495 
496  /* print */
497  /* ===== */
498 
501 
507  friend std::ostream& operator<< (std::ostream& os, const tcons1_array& s);
508 
510  void print(FILE* stream=stdout) const;
511 
513 
514 
515  /* C-level compatibility */
516  /* ===================== */
517 
520 
522  const ap_tcons1_array_t* get_ap_tcons1_array_t() const;
523 
525  ap_tcons1_array_t* get_ap_tcons1_array_t();
526 
528 
529 };
530 
531 #include "apxx_tcons1_inline.hh"
532 
533 }
534 
535 #endif /* __APXX_TCONS1_HH */
apron::tcons1::is_interval_polynomial
bool is_interval_polynomial() const
Whether the expression is polynomial and there is no rounding.
Definition: apxx_tcons1_inline.hh:288
apron::abstract0
Level 0 abstract value (ap_abstract0_t* wrapper).
Definition: apxx_abstract0.hh:78
apxx_tcons1_inline.hh
apron::tcons1_array::get_environment
environment get_environment() const
Returns the environment shared by all constraints (with incremented reference count).
Definition: apxx_tcons1_inline.hh:461
apron::tcons1_array::get_tcons0_array
const tcons0_array & get_tcons0_array() const
Returns a reference to the underlying tcons0_array.
Definition: apxx_tcons1_inline.hh:466
apron::tcons1::operator=
tcons1 & operator=(const tcons1 &x)
(Deep) copy.
Definition: apxx_tcons1_inline.hh:137
apron::tcons1::operator!=
friend tcons1 operator!=(const texpr1::builder &a, const texpr1::builder &b)
Makes a constraint a-b != 0.
apron::environment
Level 1 environment (ap_environment_t wrapper).
Definition: apxx_environment.hh:51
apron::tcons1_array::size
size_t size() const
Returns the size of the array.
Definition: apxx_tcons1_inline.hh:456
apron::tcons1::operator>=
friend tcons1 operator>=(const texpr1::builder &a, const texpr1::builder &b)
Makes a constraint a-b >= 0.
apron::tcons1::operator<=
friend tcons1 operator<=(const texpr1::builder &a, const texpr1::builder &b)
Makes a constraint b-a >= 0.
apron::tcons1::is_interval_polyfrac
bool is_interval_polyfrac() const
Whether the expression is a polynomial fraction and there is no rounding.
Definition: apxx_tcons1_inline.hh:293
apron::tcons1::get_ap_tcons1_t
const ap_tcons1_t * get_ap_tcons1_t() const
Returns a pointer to the internal APRON object stored in *this.
Definition: apxx_tcons1_inline.hh:307
apron::tcons0_array
Array of arbitrary constraints (ap_tcons0_array_t wrapper).
Definition: apxx_tcons0.hh:350
apron::tcons1_array::print
void print(FILE *stream=stdout) const
Prints to a C stream.
Definition: apxx_tcons1_inline.hh:521
apron::abstract1
Level 1 abstract value (ap_abstract1_t wrapper).
Definition: apxx_abstract1.hh:42
apron::tcons1::set_modulo
void set_modulo(const scalar &c)
Sets the extra scalar modulo to c (copied).
Definition: apxx_tcons1_inline.hh:160
apron::use_malloc
Inherited by most wrappers to map new and delete to malloc and free.
Definition: apxx_scalar.hh:69
apron::tcons1::is_interval_linear
bool is_interval_linear() const
Whether the expression is linear and there is no rounding.
Definition: apxx_tcons1_inline.hh:283
apron::tcons1_array::operator<<
friend std::ostream & operator<<(std::ostream &os, const tcons1_array &s)
Printing.
apron::tcons1::has_modulo
bool has_modulo() const
Returns whether the constraint has a valid extra scalar (used in modulo constraints).
Definition: apxx_tcons1_inline.hh:217
apron::tcons1_array::set
void set(size_t i, const tcons1 &x)
Changes the constraint at index i.
Definition: apxx_tcons1_inline.hh:484
apxx_texpr1.hh
apron::tcons1_array::operator=
tcons1_array & operator=(const tcons1_array &x)
(Deep) copy.
Definition: apxx_tcons1_inline.hh:395
apron::tcons1::print
void print(FILE *stream=stdout) const
Prints to a C stream.
Definition: apxx_tcons1_inline.hh:269
apron::tcons1::get_environment
environment get_environment() const
Returns the environment of the expression (with incremented reference count).
Definition: apxx_tcons1_inline.hh:192
apron::tcons1::get_tcons0
const tcons0 & get_tcons0() const
Returns a reference to the underlying tcons0.
Definition: apxx_tcons1_inline.hh:197
apron::lincons1
Level 1 linear constraint (ap_lincons1_t wrapper).
Definition: apxx_lincons1.hh:40
apron::tcons1::operator>
friend tcons1 operator>(const texpr1::builder &a, const texpr1::builder &b)
Makes a constraint a-b > 0.
apron::tcons1::~tcons1
~tcons1()
Frees the constraint, including the embedded expression tree and optional modulo scalar.
Definition: apxx_tcons1_inline.hh:82
apron::tcons1_array::resize
void resize(size_t size)
Resizes the array.
Definition: apxx_tcons1_inline.hh:439
apron::tcons1_array
Array of arbitrary constraints (ap_tcons1_array_t wrapper).
Definition: apxx_tcons1.hh:337
apron::tcons1::get_modulo
scalar & get_modulo()
Returns a (modifiable) reference to the extra scalar.
Definition: apxx_tcons1_inline.hh:227
apron::tcons1_array::tcons1_array
tcons1_array(ap_tcons1_array_t &a)
Internal use only. Performs a shallow copy and takes ownership of the contents.
Definition: apxx_tcons1_inline.hh:330
apron::tcons1_array::a
ap_tcons1_array_t a
Structure managed by APRON.
Definition: apxx_tcons1.hh:341
apron::tcons1_array::extend_environment
void extend_environment(const environment &e)
Extends the environment of all expressions in array.
Definition: apxx_tcons1_inline.hh:444
apron::tcons0
Level 0 arbitrary constraint (ap_tcons0_t wrapper).
Definition: apxx_tcons0.hh:47
apron::tcons1::operator<
friend tcons1 operator<(const texpr1::builder &a, const texpr1::builder &b)
Makes a constraint b-a > 0.
apxx_tcons0.hh
apron::tcons1::get_texpr
texpr1::iterator get_texpr()
Returns an iterator to the root of the underlying expression tree.
Definition: apxx_tcons1_inline.hh:239
apron::tcons1::tcons1
tcons1(ap_tcons1_t l)
Internal use only. Performs a shallow copy and takes ownership of the contents.
Definition: apxx_tcons1_inline.hh:28
apron::tcons1::is_scalar
bool is_scalar() const
Whether all occurring constants are scalar.
Definition: apxx_tcons1_inline.hh:298
apron::texpr1::const_iterator
Iterators to traverse a constant expression tree.
Definition: apxx_texpr1.hh:183
apron::tcons1_array::~tcons1_array
~tcons1_array()
Frees the space used by the array and all its constraints.
Definition: apxx_tcons1_inline.hh:386
apron::tcons1::has_texpr
bool has_texpr() const
Whether the constraint contains a valid expression tree.
Definition: apxx_tcons1_inline.hh:222
apron::tcons1_array::get_ap_tcons1_array_t
const ap_tcons1_array_t * get_ap_tcons1_array_t() const
Returns a pointer to the internal APRON object stored in *this.
Definition: apxx_tcons1_inline.hh:530
apron::unsat
Unsatisfiable constraint, to simplify initialisations and assignments.
Definition: apxx_lincons0.hh:28
apron::tcons1::operator==
friend tcons1 operator==(const texpr1::builder &a, const texpr1::builder &b)
Makes a constraint a-b == 0.
apron::texpr1::iterator
Iterators to traverse and mutate an expression tree.
Definition: apxx_texpr1.hh:386
apron::tcons1::set_texpr
void set_texpr(const texpr1::builder &c)
Sets the underlying expression tree to c (copied).
Definition: apxx_tcons1_inline.hh:165
apron::tcons1::l
ap_tcons1_t l
Structure managed by APRON.
Definition: apxx_tcons1.hh:43
apron::tcons1
Level 1 arbitrary constraint (ap_tcons1_t wrapper).
Definition: apxx_tcons1.hh:39
apron::scalar
Scalar (ap_scalar_t wrapper).
Definition: apxx_scalar.hh:89
apron::tcons1_array::get
tcons1 get(size_t i) const
Returns a copy of the constraint at index i.
Definition: apxx_tcons1_inline.hh:476
apron::tcons1::extend_environment
void extend_environment(const environment &e)
Extends the environment of the expression.
Definition: apxx_tcons1_inline.hh:179
apron
Definition: apxx_abstract0.hh:27
apron::tcons1::get_constyp
ap_constyp_t & get_constyp()
Returns a (modifiable) reference to the constraint type.
Definition: apxx_tcons1_inline.hh:207
apron::texpr1::builder
Temporary expression nodes used when constructing a texpr1.
Definition: apxx_texpr1.hh:561
apron::tcons1::operator<<
friend std::ostream & operator<<(std::ostream &os, const tcons1 &s)
Printing.
apron::tcons1::is_interval_cst
bool is_interval_cst() const
Whether the expression is constant (i.e., has no dimension leaves).
Definition: apxx_tcons1_inline.hh:278