16 #ifndef __APXX_TEXPR1_HH 17 #define __APXX_TEXPR1_HH 19 #include "ap_texpr1.h" 52 void init_from(ap_environment_t* e, ap_texpr0_t* x);
99 template<
class T>
texpr1(
const T& x);
258 ap_texpr_op_t
get_op()
const;
324 size_t depth()
const;
360 void print(FILE* stream=stdout)
const;
394 iterator(ap_texpr0_t* t, ap_environment_t* e);
470 ap_texpr_op_t&
get_op()
const;
576 void init_from(ap_environment_t* e, ap_texpr0_t* x);
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);
732 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
750 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
754 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
758 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
762 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
766 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
770 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
774 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
778 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
794 ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir);
834 void print(FILE* stream=stdout)
const;
876 size_t depth()
const;
texpr1(const texpr1 &x, const var &src, const texpr1 &dst)
Makes a (deep) copy of x and substitutes every occurrence of the src variable name with a fresh copy ...
Definition: apxx_texpr1.hh:93
bool is_interval_linear() const
Whether the expression is linear and there is no rounding.
Definition: apxx_texpr1.hh:233
Iterators to traverse and mutate an expression tree.
Definition: apxx_texpr0.hh:413
ap_texpr1_t * get_ap_texpr1_t()
Returns a pointer to the internal APRON object stored in *this.
Definition: apxx_texpr1.hh:616
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
const coeff & get_coeff() const
Returns a reference to the coefficient of a constant node.
Definition: apxx_texpr1.hh:338
iterator & operator=(const builder &x)
Replace the sub-expression at the iterator position with a (deep) copy of c.
Definition: apxx_texpr1.hh:524
bool equal(const texpr1 &x) const
Whether two expressions are syntactically, structurally equal.
Definition: apxx_texpr1.hh:203
iterator child() const
Constructs an iterator to the only or left sub-expression of an operator node.
Definition: apxx_texpr1.hh:591
Definition: apxx_abstract0.hh:27
const_iterator right() const
Constructs a const_iterator to the right sub-expression argument of a binary operator node.
Definition: apxx_texpr1.hh:398
size_t depth() const
Returns the depth of the expression tree (counting only operator nodes).
Definition: apxx_texpr1.hh:433
texpr0::iterator get_texpr0() const
Returns an iterator at the root of the underlying texpr0.
Definition: apxx_texpr1.hh:537
ap_texpr1_t l
Structure managed by APRON.
Definition: apxx_texpr1.hh:46
Variable name (ap_var_t wrapper).
Definition: apxx_var.hh:39
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
texpr1(ap_texpr1_t *x)
Internal use only. Shallow copy.
Definition: apxx_texpr1.hh:31
ap_texpr_op_t get_op() const
Returns the operator kind of an operator node.
Definition: apxx_texpr1.hh:356
bool is_scalar() const
Whether all occurring constants are scalar.
Definition: apxx_texpr1.hh:474
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
bool has_var(const var &v) const
Whether the given variable name occurs in the expression.
Definition: apxx_texpr1.hh:448
ap_texpr_rdir_t get_rdir() const
Returns the rounding direction of an operator node.
Definition: apxx_texpr1.hh:368
texpr0::const_iterator get_texpr0() const
Returns a constant iterator at the root of the underlying texpr0.
Definition: apxx_texpr1.hh:328
iterator left() const
Constructs an iterator to the only of left sub-expression of an operator node.
Definition: apxx_texpr1.hh:598
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
ap_texpr_op_t & get_op() const
Returns a (modifiable) reference to the operator kind of an operator node.
Definition: apxx_texpr1.hh:563
size_t size() const
Returns the number of operator nodes in the expression tree.
Definition: apxx_texpr1.hh:443
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
size_t size() const
Returns the number of operator nodes in the expression tree.
Definition: apxx_texpr1.hh:218
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
const_iterator & operator=(const const_iterator &i)
Resets the const_iterator at position i.
Definition: apxx_texpr1.hh:378
iterator right() const
Constructs an iterator to the right sub-expression argument of a binary operator node.
Definition: apxx_texpr1.hh:605
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 operator+(const builder &a)
Makes a copy of the node.
Definition: apxx_texpr1.hh:921
bool is_interval_linear() const
Whether the expression is linear and there is no rounding.
Definition: apxx_texpr1.hh:459
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 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 std::ostream & operator<<(std::ostream &os, const const_iterator &s)
Printing.
Definition: apxx_texpr1.hh:411
Temporary expression nodes used when constructing a texpr1.
Definition: apxx_texpr1.hh:561
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
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
const_iterator left() const
Constructs a const_iterator to the only of left sub-expression of an operator node.
Definition: apxx_texpr1.hh:391
texpr0::const_iterator get_texpr0() const
Returns a constant iterator at the root of the underlying texpr0.
Definition: apxx_texpr1.hh:193
void set_var(const var &v) const
Sets the variable name of a dimension node.
Definition: apxx_texpr1.hh:549
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
bool is_zero() const
Whether the expression is a single coefficient node with 0 value.
Definition: apxx_texpr1.hh:438
ap_texpr_rtype_t get_rtype() const
Returns the destination type of an operator node.
Definition: apxx_texpr1.hh:362
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
Iterators to traverse a constant expression tree.
Definition: apxx_texpr0.hh:211
Level 1 environment (ap_environment_t wrapper).
Definition: apxx_environment.hh:51
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_texpr1_t * get_ap_texpr1_t()
Returns a pointer to the internal APRON object stored in *this.
Definition: apxx_texpr1.hh:989
void print(FILE *stream=stdout) const
Prints to a C stream.
Definition: apxx_texpr1.hh:165
builder & operator=(const builder &x)
Not to be used. (Temporaries are not to be re-assigned).
Definition: apxx_texpr1.hh:570
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
ap_texpr1_t l
Definition: apxx_texpr1.hh:187
const_iterator(ap_texpr1_t *l)
Internal use only.
Definition: apxx_texpr1.hh:307
~builder()
Frees the memory occupied by the node, not its sub-expressions.
Definition: apxx_texpr1.hh:974
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 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
size_t depth() const
Returns the depth of the expression tree (counting only operator nodes).
Definition: apxx_texpr1.hh:208
bool is_zero() const
Whether the expression is a single coefficient node with 0 value.
Definition: apxx_texpr1.hh:213
Level 1 linear expression (ap_linexpr1_t wrapper).
Definition: apxx_linexpr1.hh:39
Level 0 arbitrary expression tree (ap_texpr0_t wrapper).
Definition: apxx_texpr0.hh:92
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
Coefficient (ap_coeff_t wrapper).
Definition: apxx_coeff.hh:36
ap_texpr1_t * get_ap_texpr1_t()
Returns a pointer to the internal APRON object stored in *this.
Definition: apxx_texpr1.hh:483
ap_texpr1_t * get_ap_texpr1_t()
Returns a pointer to the internal APRON object stored in *this.
Definition: apxx_texpr1.hh:272
Full interval (]-oo,+oo[) or domain, to simplify initialisations and assignments.
Definition: apxx_interval.hh:27
bool is_interval_cst() const
Whether the expression is constant (i.e., has no dimension leaves).
Definition: apxx_texpr1.hh:228
ap_texpr_rtype_t & get_rtype() const
Returns a (modifiable) reference to the destination type of an operator node.
Definition: apxx_texpr1.hh:569
ap_texpr_discr_t get_discr() const
Returns the node kind.
Definition: apxx_texpr1.hh:333
bool is_interval_polynomial() const
Whether the expression is polynomial and there is no rounding.
Definition: apxx_texpr1.hh:464
const_iterator root() const
Returns a new iterator at the root of a constant expression tree.
Definition: apxx_texpr1.hh:296
Interval (ap_interval_t wrapper).
Definition: apxx_interval.hh:47
Inherited by most wrappers to map new and delete to malloc and free.
Definition: apxx_scalar.hh:69
bool is_interval_polyfrac() const
Whether the expression is a polynomial fraction and there is no rounding.
Definition: apxx_texpr1.hh:243
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
void substitute(const var &src, const texpr1 &dst)
Substitutes each occurrence of src with (a fresh copy of) dst.
Definition: apxx_texpr1.hh:257
void init_from(ap_environment_t *e, ap_texpr0_t *x)
Internal use only. Shallow copy.
Definition: apxx_texpr1.hh:19
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
bool is_interval_polynomial() const
Whether the expression is polynomial and there is no rounding.
Definition: apxx_texpr1.hh:238
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
A fraction with native int coefficients, to simplify initialisations and assignments.
Definition: apxx_scalar.hh:41
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
void print(FILE *stream=stdout) const
Prints to a C stream.
Definition: apxx_texpr1.hh:418
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
bool is_interval_polyfrac() const
Whether the expression is a polynomial fraction and there is no rounding.
Definition: apxx_texpr1.hh:469
coeff & get_coeff() const
Returns a (modifiable) reference to the coefficient of a constant node.
Definition: apxx_texpr1.hh:543
bool has_var(const var &v) const
Whether the given variable name occurs in the expression.
Definition: apxx_texpr1.hh:223
texpr1 & operator=(const texpr1 &x)
Makes a (deep) copy of the expression.
Definition: apxx_texpr1.hh:118
ap_dim_t get_dim() const
Returns the dimension of a dimension node.
Definition: apxx_texpr1.hh:350
iterator(ap_texpr1_t *l)
Internal use only.
Definition: apxx_texpr1.hh:506
~texpr1()
Frees the memory occupied by the expression and decrements the reference count of the environment.
Definition: apxx_texpr1.hh:108
Iterators to traverse and mutate an expression tree.
Definition: apxx_texpr1.hh:386
Iterators to traverse a constant expression tree.
Definition: apxx_texpr1.hh:183
Level 1 arbitrary expression tree (ap_texpr1_t wrapper).
Definition: apxx_texpr1.hh:42
environment get_environment() const
Returns (a copy of) the environment associated with the expression.
Definition: apxx_texpr1.hh:323
bool is_interval_cst() const
Whether the expression is constant (i.e., has no dimension leaves).
Definition: apxx_texpr1.hh:454
Level 1 arbitrary constraint (ap_tcons1_t wrapper).
Definition: apxx_tcons1.hh:39
bool is_scalar() const
Whether all occurring constants are scalar.
Definition: apxx_texpr1.hh:248
bool is_zero() const
Whether the expression is a single coefficient node with 0 value.
Definition: apxx_texpr1.hh:965
friend std::ostream & operator<<(std::ostream &os, const texpr1 &s)
Printing.
Definition: apxx_texpr1.hh:160
Temporary expression nodes used when constructing a texpr0.
Definition: apxx_texpr0.hh:581
const var & get_var() const
Returns a (unmodifiable) reference to the variable name of a dimension node.
Definition: apxx_texpr1.hh:344
ap_texpr1_t l
Definition: apxx_texpr1.hh:567
bool equal(const texpr1 &x) const
Whether two expressions are syntactically, structurally equal.
Definition: apxx_texpr1.hh:427
texpr1 & operator=(const const_iterator &x)
Makes a (deep) copy of the expression.
Definition: apxx_texpr1.hh:136
ap_dim_t & get_dim() const
Returns a (modifiable) reference to the dimension of a dimension node.
Definition: apxx_texpr1.hh:557
Scalar (ap_scalar_t wrapper).
Definition: apxx_scalar.hh:89
ap_texpr_rdir_t & get_rdir() const
Returns a (modifiable) reference to the rounding direction of an operator node.
Definition: apxx_texpr1.hh:575