Iterators to traverse a constant expression tree.
More...
#include <apxx_texpr0.hh>
Inherited by apron::texpr0::iterator.
|
|
| | const_iterator (const texpr0 &e) |
| | Starts a new const_iterator at the root of a constant expression tree.
|
| |
| | const_iterator (const const_iterator &i) |
| | Duplicates the const_iterator.
|
| |
|
| ap_texpr_discr_t | get_discr () const |
| | Returns the node kind.
|
| |
| const coeff & | get_coeff () const |
| | Returns a reference to the coefficient of a constant node.
|
| |
| ap_dim_t | get_dim () const |
| | Returns the dimension of a dimension node.
|
| |
| ap_texpr_op_t | get_op () const |
| | Returns the operator kind of an operator node.
|
| |
| ap_texpr_rtype_t | get_rtype () const |
| | Returns the destination type of an operator node.
|
| |
| ap_texpr_rdir_t | get_rdir () const |
| | Returns the rounding direction of an operator node.
|
| |
|
| const_iterator & | operator= (const const_iterator &i) |
| | Resets the const_iterator at position i.
|
| |
| const_iterator | child () const |
| | Constructs a const_iterator to the only or left sub-expression of an operator node.
|
| |
| const_iterator | left () const |
| | Constructs a const_iterator to the only of left sub-expression of an operator node.
|
| |
| const_iterator | right () const |
| | Constructs a const_iterator to the right sub-expression argument of a binary operator node.
|
| |
|
| bool | equal (const texpr0 &x) const |
| | Whether two expressions are syntactically, structurally equal.
|
| |
| bool | is_zero () const |
| | Whether the expression is a single coefficient node with 0 value.
|
| |
| size_t | depth () const |
| | Returns the depth of the expression tree (counting only operator nodes).
|
| |
| size_t | size () const |
| | Returns the number of operator nodes in the expression tree.
|
| |
| ap_dim_t | max_dim () const |
| | Returns the maximal dimension occurring in the expression (or 0 if there is no variable).
|
| |
| bool | has_dim (ap_dim_t d) const |
| | Whether the given dimension occurs in the expression.
|
| |
| std::vector< ap_dim_t > | dimlist () const |
| | Returns a list of all dimensions occurring in the expression (in strict increasing order)
|
| |
| bool | is_interval_cst () const |
| | Whether the expression is constant (i.e., has no dimension leaves).
|
| |
| bool | is_interval_linear () const |
| | Whether the expression is linear and there is no rounding.
|
| |
| bool | is_interval_polynomial () const |
| | Whether the expression is polynomial and there is no rounding.
|
| |
| bool | is_interval_polyfrac () const |
| | Whether the expression is a polynomial fraction and there is no rounding.
|
| |
| bool | is_scalar () const |
| | Whether all occurring constants are scalar.
|
| |
|
| ap_texpr0_t * | get_ap_texpr0_t () |
| | Returns a pointer to the internal APRON object stored in *this.
|
| |
| const ap_texpr0_t * | get_ap_texpr0_t () const |
| | Returns a pointer to the internal APRON object stored in *this.
|
| |
|
| void | print (char **name_of_dim=NULL, FILE *stream=stdout) const |
| | Prints to a C stream.
|
| |
Iterators to traverse a constant expression tree.
For lack of better name, an 'iterator' object is used to reference an expression node within a constant expression tree. Through the 'iterator', nodes can be examined. However, 'iterators' traverse the tree in a functional way: you spawn new const_iterator objects for left and right children.
Use the iterator class if you also wish to mutate an expression.
- Warning
- You can no longer use a const_iterator after the corresponding node has been discarded (i.e., part of a destroyed expression, part of a sub-expression substituted away, etc.). However, you can safely destroy the const_iterator after the node has been destroyed (provided you do not use it in the meantime).
◆ const_iterator() [1/3]
| texpr0::const_iterator::const_iterator |
( |
ap_texpr0_t * | l | ) |
|
|
inlineprotected |
◆ const_iterator() [2/3]
| texpr0::const_iterator::const_iterator |
( |
const texpr0 & | e | ) |
|
|
inline |
Starts a new const_iterator at the root of a constant expression tree.
◆ const_iterator() [3/3]
◆ child()
Constructs a const_iterator to the only or left sub-expression of an operator node.
- Exceptions
-
◆ depth()
| size_t texpr0::const_iterator::depth |
( |
| ) |
const |
|
inline |
Returns the depth of the expression tree (counting only operator nodes).
◆ dimlist()
| std::vector< ap_dim_t > texpr0::const_iterator::dimlist |
( |
| ) |
const |
|
inline |
Returns a list of all dimensions occurring in the expression (in strict increasing order)
◆ equal()
| bool texpr0::const_iterator::equal |
( |
const texpr0 & | x | ) |
const |
|
inline |
Whether two expressions are syntactically, structurally equal.
◆ get_ap_texpr0_t() [1/2]
| ap_texpr0_t * texpr0::const_iterator::get_ap_texpr0_t |
( |
| ) |
|
|
inline |
Returns a pointer to the internal APRON object stored in *this.
◆ get_ap_texpr0_t() [2/2]
| const ap_texpr0_t * texpr0::const_iterator::get_ap_texpr0_t |
( |
| ) |
const |
|
inline |
Returns a pointer to the internal APRON object stored in *this.
◆ get_coeff()
| const coeff & texpr0::const_iterator::get_coeff |
( |
| ) |
const |
|
inline |
Returns a reference to the coefficient of a constant node.
- Exceptions
-
◆ get_dim()
| ap_dim_t texpr0::const_iterator::get_dim |
( |
| ) |
const |
|
inline |
Returns the dimension of a dimension node.
- Exceptions
-
◆ get_discr()
| ap_texpr_discr_t texpr0::const_iterator::get_discr |
( |
| ) |
const |
|
inline |
Returns the node kind.
- Returns
AP_TEXPR_CST for a constant node, AP_TEXPR_DIM for a dimension, and AP_TEXPR_NODE for an operator node.
◆ get_op()
| ap_texpr_op_t texpr0::const_iterator::get_op |
( |
| ) |
const |
|
inline |
Returns the operator kind of an operator node.
- Returns
- either
AP_TEXPR_ADD, AP_TEXPR_SUB, AP_TEXPR_MUL, AP_TEXPR_DIV, AP_TEXPR_MOD, AP_TEXPR_POW AP_TEXPR_NEG, AP_TEXPR_CAST, or AP_TEXPR_SQRT.
- Exceptions
-
◆ get_rdir()
| ap_texpr_rdir_t texpr0::const_iterator::get_rdir |
( |
| ) |
const |
|
inline |
Returns the rounding direction of an operator node.
- Returns
- either
AP_RDIR_NEAREST, AP_RDIR_ZERO, AP_RDIR_UP, AP_RDIR_DOWN, or AP_RDIR_RND.
- Exceptions
-
◆ get_rtype()
| ap_texpr_rtype_t texpr0::const_iterator::get_rtype |
( |
| ) |
const |
|
inline |
Returns the destination type of an operator node.
- Returns
- either
AP_RTYPE_REAL, AP_RTYPE_INT, AP_RTYPE_SINGLE (32-bit), AP_RTYPE_DOUBLE (64-bit), AP_RTYPE_EXTENDED (80-bit), or AP_RTYPE_QUAD (128-bit).
- Exceptions
-
◆ has_dim()
| bool texpr0::const_iterator::has_dim |
( |
ap_dim_t | d | ) |
const |
|
inline |
Whether the given dimension occurs in the expression.
◆ is_interval_cst()
| bool texpr0::const_iterator::is_interval_cst |
( |
| ) |
const |
|
inline |
Whether the expression is constant (i.e., has no dimension leaves).
◆ is_interval_linear()
| bool texpr0::const_iterator::is_interval_linear |
( |
| ) |
const |
|
inline |
Whether the expression is linear and there is no rounding.
◆ is_interval_polyfrac()
| bool texpr0::const_iterator::is_interval_polyfrac |
( |
| ) |
const |
|
inline |
Whether the expression is a polynomial fraction and there is no rounding.
◆ is_interval_polynomial()
| bool texpr0::const_iterator::is_interval_polynomial |
( |
| ) |
const |
|
inline |
Whether the expression is polynomial and there is no rounding.
◆ is_scalar()
| bool texpr0::const_iterator::is_scalar |
( |
| ) |
const |
|
inline |
Whether all occurring constants are scalar.
◆ is_zero()
| bool texpr0::const_iterator::is_zero |
( |
| ) |
const |
|
inline |
Whether the expression is a single coefficient node with 0 value.
◆ left()
Constructs a const_iterator to the only of left sub-expression of an operator node.
(Identical to child()).
- Exceptions
-
◆ max_dim()
| ap_dim_t texpr0::const_iterator::max_dim |
( |
| ) |
const |
|
inline |
Returns the maximal dimension occurring in the expression (or 0 if there is no variable).
◆ operator=()
◆ print()
| void texpr0::const_iterator::print |
( |
char ** | name_of_dim = NULL, |
|
|
FILE * | stream = stdout ) const |
|
inline |
◆ right()
Constructs a const_iterator to the right sub-expression argument of a binary operator node.
- Exceptions
-
| bad_discriminant | if the node is not an operator node. |
| std::out_of_range | if the operator node is not binary. |
◆ size()
| size_t texpr0::const_iterator::size |
( |
| ) |
const |
|
inline |
Returns the number of operator nodes in the expression tree.
| ap_texpr0_t* apron::texpr0::const_iterator::l |
|
protected |
The documentation for this class was generated from the following files: