APRONXX 0.9.15
/home/mine/apron/apronxx/apxx_texpr1.hh
Go to the documentation of this file.
1/* -*- C++ -*-
2 * apxx_texpr1.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_TEXPR1_HH
17#define __APXX_TEXPR1_HH
18
19#include "ap_texpr1.h"
20
21#include "apxx_linexpr1.hh"
22#include "apxx_texpr0.hh"
23
24
25namespace apron {
26
27/* ================================= */
28/* texpr1 */
29/* ================================= */
30
35
36 * Internally, a texpr1 wraps together a texpr0 (memory managed) and an environment (holding a
37 * reference count).
38 *
39 * There are also level 1 equivalent of the helper classes: builder, iterator, and const_iterator.
40 *
41 */
42class texpr1 : public use_malloc {
43
44protected:
45
46 ap_texpr1_t l;
47
49 texpr1(ap_texpr1_t* x);
50
51 //! Internal use only. Shallow copy.
52 void init_from(ap_environment_t* e, ap_texpr0_t* x);
53
55 void init_from(ap_texpr1_t* x);
56
57public:
58
59 class builder;
60 class iterator;
61 class const_iterator;
62
63
64 /* constructors */
65 /* ============ */
66
69
70
71 texpr1(const builder& c);
72
74 texpr1(const const_iterator& x);
75
76
77 texpr1(const texpr1& x);
82
83 texpr1(const environment& e, const var& v);
84
88 texpr1(const environment& e, const texpr0::const_iterator& x);
89
92
93 texpr1(const environment& e, const texpr0& x);
94
96 texpr1(const environment& e, const texpr0::builder& c);
97
98#if 0
100 template<class T> texpr1(const T& x);
101
103 template<class T> texpr1(const environment& e, const T& x);
104#endif
105
108 * Real-valued addition and multiplication operators are used (i.e., no rounding).
109 */
110 texpr1(const linexpr1& l);
111
113
116 texpr1(const texpr1& x, const environment& e);
117
118 /*! \brief Makes a (deep) copy of x and substitutes every occurrence of the src variable name with
119 * a fresh copy of the dst expression.
120 *
121 * \throw std::invalid_argument if the environments are not equal or do not contain the variable.
122 */
123 texpr1(const texpr1& x, const var& src, const texpr1& dst);
124
126
128 /* destructor */
129 /* ========== */
130
133
135 ~texpr1();
138
139 /* assignment */
140 /* ========== */
141
144
145 //! Makes a (deep) copy of the expression.
146 texpr1& operator=(const texpr1& x);
147
150
152
154 texpr1& operator=(const builder& x);
155
156
157#if 0
159 template<class T> texpr1& operator=(const T& x);
160#endif
161
164
165 */
166 texpr1& operator= (const linexpr1& x);
167
169
170
171
172 /* iterators */
173 /* ========= */
174
178
184
185 protected:
186
187 ap_texpr1_t l;
190 const_iterator(ap_texpr1_t* l);
191
192
193 const_iterator(ap_texpr0_t* t, ap_environment_t* e);
194
195 friend class texpr1;
196 friend class tcons1;
197
198 public:
199
200 /* constructors */
201 /* ============ */
202
203 /** @name Constructors */
205
207 const_iterator(const texpr1& e);
211
212
214
215 /* access */
216 /* ====== */
217
218 /** @name Access */
220
227
229 * \return \c AP_TEXPR_CST for a constant node, \c AP_TEXPR_DIM for a dimension,
230 * and \c AP_TEXPR_NODE for an operator node.
231 */
232 ap_texpr_discr_t get_discr() const;
237
238 const coeff& get_coeff() const;
239
242
243 */
244 const var& get_var() const;
245
247
248 * \throw bad_discriminant if the node is not a dimension node.
249 */
250 ap_dim_t get_dim() const;
251
252
257 */
258 ap_texpr_op_t get_op() const;
259
266 ap_texpr_rtype_t get_rtype() const;
267
272 */
273 ap_texpr_rdir_t get_rdir() const;
274
276
278 /* traversal */
279 /* ========= */
280
281
283
286
291 const_iterator child() const;
292
296 * \throw bad_discriminant if the node is not an operator node.
297 */
298 const_iterator left() const;
299
300
302 * \throw bad_discriminant if the node is not an operator node.
303 * \throw std::out_of_range if the operator node is not binary.
304 */
305 const_iterator right() const;
306
307 //@}
308
309
310 /* tests, size, dimensions */
311 /* ======================= */
312
314
316
318 bool equal(const texpr1& x) const;
319
321 bool is_zero() const;
322
323 //! Returns the depth of the expression tree (counting only operator nodes).
324 size_t depth() const;
325
327 size_t size() const;
330 bool has_var(const var& v) const;
331
332
333 bool is_interval_cst() const;
334
336 bool is_interval_linear() const;
337
338 //! Whether the expression is polynomial and there is no rounding.
339 bool is_interval_polynomial() const;
340
342 bool is_interval_polyfrac() const;
343
344 //! Whether all occurring constants are scalar.
345 bool is_scalar() const;
346
348
349
350 /* print */
351 /* ===== */
352
355
356 //! Printing.
357 friend std::ostream& operator<< (std::ostream& os, const const_iterator& s);
358
360 void print(FILE* stream=stdout) const;
361
362 //@}
363
364
365 /* C-level compatibility */
366 /* ===================== */
367
368 /** @name C API compatibility */
370
372 ap_texpr1_t* get_ap_texpr1_t();
373
375 const ap_texpr1_t* get_ap_texpr1_t() const;
376
379 };
380
381
383
384 * As const_iterator, but can be used to modify as well as traverse nodes.
385 */
386 class iterator : public const_iterator {
387
388 protected:
389
391 iterator(ap_texpr1_t* l);
392
394 iterator(ap_texpr0_t* t, ap_environment_t* e);
395
396 friend class texpr1;
397 friend class tcons1;
399 public:
400
401 /* constructors */
402 /* ============ */
403
404
406
408 iterator(texpr1& e);
409
412
414
415
416 /* substitution */
417 /* ============ */
421
422
426 iterator& operator= (const builder& x);
428#if 0
430 template<class T> iterator& operator= (const T& c);
431#endif
432
433 //@}
434
435
436 /* access */
437 /* ====== */
441
442
447
448 */
449 coeff& get_coeff() const;
450
453
454 * \throw std::invalid_argument if the environment does not contain a variable.
455 */
456 void set_var(const var& v) const;
457
458
460 * \throw bad_discriminant if the node is not a dimension node.
461 */
462 ap_dim_t& get_dim() const;
463
464 /*! \brief Returns a (modifiable) reference to the operator kind of an operator node.
465 *
466 * \return either \c AP_TEXPR_ADD, \c AP_TEXPR_SUB, \c AP_TEXPR_MUL, \c AP_TEXPR_DIV, \c AP_TEXPR_MOD, \c AP_TEXPR_POW,
467 * \c AP_TEXPR_NEG, \c AP_TEXPR_CAST, or \c AP_TEXPR_SQRT.
468 * \throw bad_discriminant if the node is not an operator node.
469 */
470 ap_texpr_op_t& get_op() const;
471
473
474 * \return either \c AP_RTYPE_REAL, \c AP_RTYPE_INT, \c AP_RTYPE_SINGLE (32-bit), \c AP_RTYPE_DOUBLE (64-bit),
475 * \c AP_RTYPE_EXTENDED (80-bit), or \c AP_RTYPE_QUAD (128-bit).
476 * \throw bad_discriminant if the node is not an operator node.
477 */
478 ap_texpr_rtype_t& get_rtype() const;
479
483 * \throw bad_discriminant if the node is not an operator node.
484 */
485 ap_texpr_rdir_t& get_rdir() const;
486
487
489
490 /* traversal */
491 /* ========= */
492
495
498
501
502 */
503 iterator child() const;
504
505
507 * (Identical to child()).
508 * \throw bad_discriminant if the node is not an operator node.
509 */
510 iterator left() const;
514
515 * \throw std::out_of_range if the operator node is not binary.
516 */
517 iterator right() const;
518
520
521
522 /* C-level compatibility */
523 /* ===================== */
527
529 ap_texpr1_t* get_ap_texpr1_t();
530
532 const ap_texpr1_t* get_ap_texpr1_t() const;
533
535
536 };
538
540 const_iterator root() const;
541
544
546
547
548 /* builders */
549 /* ======== */
550
553
556
558 * You should not create variables of type build, nor define functions that return or take
559 * builder objects as arguments.
560 */
561 class builder : public use_malloc {
562
563 friend class texpr1;
564
565 protected:
566
567 ap_texpr1_t l;
568
569 //! Not to be used. (Temporaries are not to be re-assigned).
570 builder& operator= (const builder& x) { assert(0); return *this; }
571
573 void init_from(ap_texpr1_t* x);
574
575 //! Internal use only: makes a shallow copy, copying only the root node and referencing the environment.
576 void init_from(ap_environment_t* e, ap_texpr0_t* x);
577
579 builder(ap_texpr1_t* x);
580
581 public:
582
583 /* constructors */
584 /* ============ */
588
590 builder(const builder& x);
593 builder(const const_iterator& x);
594
596 builder(const texpr1& x);
597
598 //! Converts from a level 0 builder and associates an environment.
599 builder(const environment& e, const texpr0::builder& b);
600
602 builder(const environment& e, const texpr0::const_iterator& b);
603
604
605 builder(const environment& e, const texpr0& b);
606
607
609 builder(const environment& e, const coeff& x);
610
611
612 builder(const environment& e, const scalar& x);
613
615 builder(const environment& e, const mpq_class& x);
618 builder(const environment& e, mpfr_t x);
619
620
621 builder(const environment& e, int x);
622
624 builder(const environment& e, long x);
625
627 builder(const environment& e, double x);
628
630 builder(const environment& e, const frac& x);
633 builder(const environment& e, const interval& x);
634
636 builder(const environment& e, const scalar& inf, const scalar& sup);
637
639 builder(const environment& e, const mpq_class& inf, const mpq_class& sup);
640
642 builder(const environment& e, mpfr_t inf, mpfr_t sup);
643
645 builder(const environment& e, int inf, int sup);
648 builder(const environment& e, long inf, long sup);
649
651 builder(const environment& e, double inf, double sup);
652
653
654 builder(const environment& e, const frac& inf, const frac& sup);
655
657 builder(const environment& e, top t);
658
659 //! Makes a variable name dimension leaf.
660 builder(const environment& e, const var& v);
661
663 builder(ap_texpr_op_t op, const builder& argA, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
666 builder(ap_texpr_op_t op, const builder& argA, const builder& argB, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
667
668
670
671 /* destructor */
672 /* ========== */
673
674 /** @name Destructor */
676
678 ~builder();
679
680 //@}
681
682
683 /* tests */
684 /* ===== */
685
689
691 bool is_zero() const;
694
695 /* C-level compatibility */
696 /* ===================== */
697
698 /** @name C API compatibility */
700
702 ap_texpr1_t* get_ap_texpr1_t();
703
704 //! Returns a pointer to the internal APRON object stored in *this.
705 const ap_texpr1_t* get_ap_texpr1_t() const;
706
708
709
710 /* 'Intelligent' constructors */
711 /* ========================== */
712
715
716 /*! \brief Makes a unary expression node.
717 *
718 * Creates only one node. The argument expression is aliased, not copied.
719 *
720 * \arg \c op should be a unary operator: negation (\c AP_TEXPR_NEG), typecast (\c AP_TEXPR_CAST),
721 * or square root (\c AP_TEXPR_SQRT).
722 * \arg \c argA should point to the argument expression.
723 * \arg \c rtype is the destination type (for rounding): reals (\c AP_RTYPE_REAL, means no rounding),
724 * perfect integers (\c AP_RTYPE_INT), 32-bit single precision (\c AP_RTYPE_SINGLE), 64-bit double precision
725 * (\c AP_RTYPE_DOUBLE), 80-bit extended precision (\c AP_RTYPE_EXTENDED), or
726 * 128-bit quadruple precision (\c AP_RTYPE_QUAD).
727 * \arg \c rdir is the rounding direction: to nearest (\c AP_RDIR_NEAREST), truncation (\c AP_RDIR_ZERO),
728 * towards +oo (\c AP_RDIR_UP), towards -oo (\c AP_RDIR_DOWN), or non-deterministic (\c AP_RDIR_RND).
729 * \throw std::invalid_argument if \c op is not a unary operator.
730 */
731 friend builder unary(ap_texpr_op_t op, const builder& a,
732 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
733
734 /*! \brief Makes a binary expression node.
735 *
736 * Creates only one node. The argument expressions is aliased, not copied.
737 *
738 * \arg \c op should be a binary operator: addition (\c AP_TEXPR_ADD), subtraction (\c AP_TEXPR_SUB),
739 * multiplication (\c AP_TEXPR_MUL), division (\c AP_TEXPR_DIV), or modulo (\c AP_TEXPR_MOD, \c AP_TEXPR_POW).
740 * \arg \c argA should point to the left argument expression.
741 * \arg \c argB should point to the right argument expression.
742 * \arg \c rtype is the destination type (for rounding): reals (\c AP_RTYPE_REAL, means no rounding),
743 * perfect integers (\c AP_RTYPE_INT), 32-bit single precision (\c AP_RTYPE_SINGLE), 64-bit double precision
744 * (\c AP_RTYPE_DOUBLE), 80-bit extended precision (\c AP_RTYPE_EXTENDED).
745 * \arg \c rdir is the rounding direction: to nearest (\c AP_RDIR_NEAREST), truncation (\c AP_RDIR_ZERO),
746 * towards +oo (\c AP_RDIR_UP), towards -oo (\c AP_RDIR_DOWN), or non-deterministic (\c AP_RDIR_RND).
747 * \throw std::invalid_argument if \c op is not a binary operator.
748 */
749 friend builder binary(ap_texpr_op_t op, const builder& a, const builder& b,
750 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
751
752
753 friend builder add(const builder& a, const builder& b,
754 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
755
757 friend builder sub(const builder& a, const builder& b,
758 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
759
760 //! Makes an \c AP_TEXPR_MUL expression node.
761 friend builder mul(const builder& a, const builder& b,
762 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
763
765 friend builder div(const builder& a, const builder& b,
766 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
767
769 friend builder mod(const builder& a, const builder& b,
770 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
771
772 //! Makes an \c AP_TEXPR_POW expression node.
773 friend builder pow(const builder& a, const builder& b,
774 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
775
777 friend builder neg(const builder& a,
778 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
779
781 friend builder cast(const builder& a, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
782
783
784 friend builder floor(const builder& a);
785
787 friend builder ceil(const builder& a);
788
789
790 friend builder trunc(const builder& a);
791
793 friend builder sqrt(const builder& a,
794 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
795
796 //! Makes a copy of the node.
797 friend builder operator+(const builder& a);
798
800 friend builder operator-(const builder& a);
801
803 friend builder operator+(const builder& a, const builder& b);
804
805 //! Makes a \c AP_TEXPR_SUB expression node using \c AP_RTYPE_REAL type (no rounding).
806 friend builder operator-(const builder& a, const builder& b);
807
809 friend builder operator*(const builder& a, const builder& b);
810
812 friend builder operator/(const builder& a, const builder& b);
813
814
815 friend builder operator%(const builder& a, const builder& b);
816
818 friend builder operator^(const builder& a, const builder& b);
819
821 };
822
823
824 /* print */
825 /* ===== */
826
831 friend std::ostream& operator<< (std::ostream& os, const texpr1& s);
832
834 void print(FILE* stream=stdout) const;
835
836 //@}
837
838
839 /* dimension operations */
840 /* ==================== */
841
842
849 void extend_environment(const environment& e);
850
851 //@}
852
853
854 /* access */
855 /* ====== */
856
857
858 //@{
859
862
868
870 bool is_zero() const;
871
872 //! Whether two expressions are syntactically, structurally equal.
873 bool equal(const texpr1& x) const;
874
876 size_t depth() const;
877
878
879 size_t size() const;
880
882 bool has_var(const var& v) const;
883
885 bool is_interval_cst() const;
888 bool is_interval_linear() const;
889
891 bool is_interval_polynomial() const;
892
893 //! Whether the expression is a polynomial fraction and there is no rounding.
894 bool is_interval_polyfrac() const;
895
897 bool is_scalar() const;
898
899 //@}
900
901 /* operations */
902 /* ========== */
903
904 /** @name Operations */
906
908
909 * \throw std::invalid_argument if the environments are not equal or do not contain src.
910 */
911 void substitute(const var& src, const texpr1& dst);
912
913
915
916
917 /* C-level compatibility */
918 /* ===================== */
919
920
921 //@{
922
924 ap_texpr1_t* get_ap_texpr1_t();
925
926 //! Returns a pointer to the internal APRON object stored in *this.
927 const ap_texpr1_t* get_ap_texpr1_t() const;
928
930
932
933#include "apxx_texpr1_inline.hh"
934
935}
937#endif /* __APXX_TEXPR1_HH */
Coefficient (ap_coeff_t wrapper).
Definition apxx_coeff.hh:36
Level 1 environment (ap_environment_t wrapper).
Definition apxx_environment.hh:51
Interval (ap_interval_t wrapper).
Definition apxx_interval.hh:47
Level 1 linear expression (ap_linexpr1_t wrapper).
Definition apxx_linexpr1.hh:39
Scalar (ap_scalar_t wrapper).
Definition apxx_scalar.hh:89
Temporary expression nodes used when constructing a texpr0.
Definition apxx_texpr0.hh:581
Iterators to traverse a constant expression tree.
Definition apxx_texpr0.hh:211
Iterators to traverse and mutate an expression tree.
Definition apxx_texpr0.hh:413
Level 0 arbitrary expression tree (ap_texpr0_t wrapper).
Definition apxx_texpr0.hh:92
Temporary expression nodes used when constructing a texpr1.
Definition apxx_texpr1.hh:561
friend builder add(const builder &a, const builder &b, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
Makes an AP_TEXPR_ADD expression node.
Definition apxx_texpr1.hh:844
friend builder mod(const builder &a, const builder &b, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
Makes an AP_TEXPR_MOD expression node.
Definition apxx_texpr1.hh:872
builder(ap_texpr1_t *x)
Internal use only: makes a shallow copy, copying only the root node and referencing the environment.
Definition apxx_texpr1.hh:654
friend builder pow(const builder &a, const builder &b, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
Makes an AP_TEXPR_POW expression node.
Definition apxx_texpr1.hh:879
friend builder trunc(const builder &a)
Makes an AP_TEXPR_CAST expression node to AP_RTYPE_INT type rounded towards AP_RDIR_ZERO.
Definition apxx_texpr1.hh:909
void init_from(ap_texpr1_t *x)
Internal use only: makes a shallow copy, copying only the root node and referencing the environment.
Definition apxx_texpr1.hh:631
friend builder sqrt(const builder &a, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
Makes an AP_TEXPR_SQRT expression node.
Definition apxx_texpr1.hh:914
builder & operator=(const builder &x)
Not to be used. (Temporaries are not to be re-assigned).
Definition apxx_texpr1.hh:570
~builder()
Frees the memory occupied by the node, not its sub-expressions.
Definition apxx_texpr1.hh:974
friend builder unary(ap_texpr_op_t op, const builder &a, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
Makes a unary expression node.
Definition apxx_texpr1.hh:829
ap_texpr1_t l
Definition apxx_texpr1.hh:567
bool is_zero() const
Whether the expression is a single coefficient node with 0 value.
Definition apxx_texpr1.hh:965
friend builder operator*(const builder &a, const builder &b)
Makes a AP_TEXPR_MUL expression node using AP_RTYPE_REAL type (no rounding).
Definition apxx_texpr1.hh:941
friend builder operator^(const builder &a, const builder &b)
Makes a AP_TEXPR_POW expression node using AP_RTYPE_REAL type (no rounding).
Definition apxx_texpr1.hh:956
friend builder floor(const builder &a)
Makes an AP_TEXPR_CAST expression node to AP_RTYPE_INT type rounded towards AP_RDIR_DOWN.
Definition apxx_texpr1.hh:899
friend builder operator/(const builder &a, const builder &b)
Makes a AP_TEXPR_DIV expression node using AP_RTYPE_REAL type (no rounding).
Definition apxx_texpr1.hh:946
friend builder binary(ap_texpr_op_t op, const builder &a, const builder &b, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
Makes a binary expression node.
Definition apxx_texpr1.hh:836
friend builder div(const builder &a, const builder &b, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
Makes an AP_TEXPR_DIV expression node.
Definition apxx_texpr1.hh:865
friend builder operator+(const builder &a)
Makes a copy of the node.
Definition apxx_texpr1.hh:921
ap_texpr1_t * get_ap_texpr1_t()
Returns a pointer to the internal APRON object stored in *this.
Definition apxx_texpr1.hh:989
friend builder cast(const builder &a, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
Makes an AP_TEXPR_CAST expression node.
Definition apxx_texpr1.hh:893
friend builder ceil(const builder &a)
Makes an AP_TEXPR_CAST expression node to AP_RTYPE_INT type rounded towards AP_RDIR_UP.
Definition apxx_texpr1.hh:904
friend builder operator-(const builder &a)
Makes a AP_TEXPR_NEG expression node using AP_RTYPE_REAL type (no rounding).
Definition apxx_texpr1.hh:926
friend builder mul(const builder &a, const builder &b, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
Makes an AP_TEXPR_MUL expression node.
Definition apxx_texpr1.hh:858
friend class texpr1
Definition apxx_texpr1.hh:563
friend builder operator%(const builder &a, const builder &b)
Makes a AP_TEXPR_MOD expression node using AP_RTYPE_REAL type (no rounding).
Definition apxx_texpr1.hh:951
friend builder neg(const builder &a, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
Makes an AP_TEXPR_NEG expression node.
Definition apxx_texpr1.hh:886
friend builder sub(const builder &a, const builder &b, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
Makes an AP_TEXPR_SUB expression node.
Definition apxx_texpr1.hh:851
Iterators to traverse a constant expression tree.
Definition apxx_texpr1.hh:183
const coeff & get_coeff() const
Returns a reference to the coefficient of a constant node.
Definition apxx_texpr1.hh:338
const_iterator right() const
Constructs a const_iterator to the right sub-expression argument of a binary operator node.
Definition apxx_texpr1.hh:398
ap_texpr_rdir_t get_rdir() const
Returns the rounding direction of an operator node.
Definition apxx_texpr1.hh:368
ap_texpr_op_t get_op() const
Returns the operator kind of an operator node.
Definition apxx_texpr1.hh:356
const_iterator left() const
Constructs a const_iterator to the only of left sub-expression of an operator node.
Definition apxx_texpr1.hh:391
bool is_scalar() const
Whether all occurring constants are scalar.
Definition apxx_texpr1.hh:474
bool is_interval_linear() const
Whether the expression is linear and there is no rounding.
Definition apxx_texpr1.hh:459
bool is_zero() const
Whether the expression is a single coefficient node with 0 value.
Definition apxx_texpr1.hh:438
const_iterator(ap_texpr1_t *l)
Internal use only.
Definition apxx_texpr1.hh:307
friend std::ostream & operator<<(std::ostream &os, const const_iterator &s)
Printing.
Definition apxx_texpr1.hh:411
bool has_var(const var &v) const
Whether the given variable name occurs in the expression.
Definition apxx_texpr1.hh:448
bool equal(const texpr1 &x) const
Whether two expressions are syntactically, structurally equal.
Definition apxx_texpr1.hh:427
const_iterator & operator=(const const_iterator &i)
Resets the const_iterator at position i.
Definition apxx_texpr1.hh:378
friend class tcons1
Definition apxx_texpr1.hh:196
ap_dim_t get_dim() const
Returns the dimension of a dimension node.
Definition apxx_texpr1.hh:350
ap_texpr1_t * get_ap_texpr1_t()
Returns a pointer to the internal APRON object stored in *this.
Definition apxx_texpr1.hh:483
texpr0::const_iterator get_texpr0() const
Returns a constant iterator at the root of the underlying texpr0.
Definition apxx_texpr1.hh:328
const var & get_var() const
Returns a (unmodifiable) reference to the variable name of a dimension node.
Definition apxx_texpr1.hh:344
void print(FILE *stream=stdout) const
Prints to a C stream.
Definition apxx_texpr1.hh:418
ap_texpr1_t l
Definition apxx_texpr1.hh:187
bool is_interval_cst() const
Whether the expression is constant (i.e., has no dimension leaves).
Definition apxx_texpr1.hh:454
size_t size() const
Returns the number of operator nodes in the expression tree.
Definition apxx_texpr1.hh:443
friend class texpr1
Definition apxx_texpr1.hh:195
ap_texpr_discr_t get_discr() const
Returns the node kind.
Definition apxx_texpr1.hh:333
environment get_environment() const
Returns (a copy of) the environment associated with the expression.
Definition apxx_texpr1.hh:323
bool is_interval_polynomial() const
Whether the expression is polynomial and there is no rounding.
Definition apxx_texpr1.hh:464
size_t depth() const
Returns the depth of the expression tree (counting only operator nodes).
Definition apxx_texpr1.hh:433
bool is_interval_polyfrac() const
Whether the expression is a polynomial fraction and there is no rounding.
Definition apxx_texpr1.hh:469
const_iterator child() const
Constructs a const_iterator to the only or left sub-expression of an operator node.
Definition apxx_texpr1.hh:384
ap_texpr_rtype_t get_rtype() const
Returns the destination type of an operator node.
Definition apxx_texpr1.hh:362
Iterators to traverse and mutate an expression tree.
Definition apxx_texpr1.hh:386
iterator child() const
Constructs an iterator to the only or left sub-expression of an operator node.
Definition apxx_texpr1.hh:591
iterator right() const
Constructs an iterator to the right sub-expression argument of a binary operator node.
Definition apxx_texpr1.hh:605
texpr0::iterator get_texpr0() const
Returns an iterator at the root of the underlying texpr0.
Definition apxx_texpr1.hh:537
iterator(ap_texpr1_t *l)
Internal use only.
Definition apxx_texpr1.hh:506
iterator left() const
Constructs an iterator to the only of left sub-expression of an operator node.
Definition apxx_texpr1.hh:598
coeff & get_coeff() const
Returns a (modifiable) reference to the coefficient of a constant node.
Definition apxx_texpr1.hh:543
ap_dim_t & get_dim() const
Returns a (modifiable) reference to the dimension of a dimension node.
Definition apxx_texpr1.hh:557
ap_texpr_rtype_t & get_rtype() const
Returns a (modifiable) reference to the destination type of an operator node.
Definition apxx_texpr1.hh:569
friend class tcons1
Definition apxx_texpr1.hh:397
ap_texpr1_t * get_ap_texpr1_t()
Returns a pointer to the internal APRON object stored in *this.
Definition apxx_texpr1.hh:616
friend class texpr1
Definition apxx_texpr1.hh:396
iterator & operator=(const builder &x)
Replace the sub-expression at the iterator position with a (deep) copy of c.
Definition apxx_texpr1.hh:524
ap_texpr_op_t & get_op() const
Returns a (modifiable) reference to the operator kind of an operator node.
Definition apxx_texpr1.hh:563
void set_var(const var &v) const
Sets the variable name of a dimension node.
Definition apxx_texpr1.hh:549
ap_texpr_rdir_t & get_rdir() const
Returns a (modifiable) reference to the rounding direction of an operator node.
Definition apxx_texpr1.hh:575
Level 1 arbitrary expression tree (ap_texpr1_t wrapper).
Definition apxx_texpr1.hh:42
const_iterator root() const
Returns a new iterator at the root of a constant expression tree.
Definition apxx_texpr1.hh:296
bool is_interval_polyfrac() const
Whether the expression is a polynomial fraction and there is no rounding.
Definition apxx_texpr1.hh:243
friend std::ostream & operator<<(std::ostream &os, const texpr1 &s)
Printing.
Definition apxx_texpr1.hh:160
size_t size() const
Returns the number of operator nodes in the expression tree.
Definition apxx_texpr1.hh:218
texpr1 & operator=(const texpr1 &x)
Makes a (deep) copy of the expression.
Definition apxx_texpr1.hh:118
bool has_var(const var &v) const
Whether the given variable name occurs in the expression.
Definition apxx_texpr1.hh:223
bool is_interval_linear() const
Whether the expression is linear and there is no rounding.
Definition apxx_texpr1.hh:233
bool is_zero() const
Whether the expression is a single coefficient node with 0 value.
Definition apxx_texpr1.hh:213
bool equal(const texpr1 &x) const
Whether two expressions are syntactically, structurally equal.
Definition apxx_texpr1.hh:203
bool is_scalar() const
Whether all occurring constants are scalar.
Definition apxx_texpr1.hh:248
void substitute(const var &src, const texpr1 &dst)
Substitutes each occurrence of src with (a fresh copy of) dst.
Definition apxx_texpr1.hh:257
texpr0::const_iterator get_texpr0() const
Returns a constant iterator at the root of the underlying texpr0.
Definition apxx_texpr1.hh:193
void print(FILE *stream=stdout) const
Prints to a C stream.
Definition apxx_texpr1.hh:165
bool is_interval_polynomial() const
Whether the expression is polynomial and there is no rounding.
Definition apxx_texpr1.hh:238
bool is_interval_cst() const
Whether the expression is constant (i.e., has no dimension leaves).
Definition apxx_texpr1.hh:228
void init_from(ap_environment_t *e, ap_texpr0_t *x)
Internal use only. Shallow copy.
Definition apxx_texpr1.hh:19
environment get_environment() const
Returns the environment of the expression (with incremented reference count).
Definition apxx_texpr1.hh:188
void extend_environment(const environment &e)
Extends the environment of the expression.
Definition apxx_texpr1.hh:175
ap_texpr1_t l
Structure managed by APRON.
Definition apxx_texpr1.hh:46
~texpr1()
Frees the memory occupied by the expression and decrements the reference count of the environment.
Definition apxx_texpr1.hh:108
texpr1(ap_texpr1_t *x)
Internal use only. Shallow copy.
Definition apxx_texpr1.hh:31
size_t depth() const
Returns the depth of the expression tree (counting only operator nodes).
Definition apxx_texpr1.hh:208
ap_texpr1_t * get_ap_texpr1_t()
Returns a pointer to the internal APRON object stored in *this.
Definition apxx_texpr1.hh:272
Variable name (ap_var_t wrapper).
Definition apxx_var.hh:39
Definition apxx_abstract0.hh:27
A fraction with native int coefficients, to simplify initialisations and assignments.
Definition apxx_scalar.hh:41
Full interval (]-oo,+oo[) or domain, to simplify initialisations and assignments.
Definition apxx_interval.hh:27
Inherited by most wrappers to map new and delete to malloc and free.
Definition apxx_scalar.hh:69