APRONXX  0.9.12
Protected Member Functions | List of all members
apron::texpr0::iterator Class Reference

Iterators to traverse and mutate an expression tree. More...

#include <apxx_texpr0.hh>

Inherits apron::texpr0::const_iterator.

Public Member Functions

Constructors
 iterator (texpr0 &e)
 Starts a new iterator at the root of the tree. More...
 
 iterator (const iterator &i)
 Duplicates the iterator. More...
 
Expression substitutions
iteratoroperator= (const builder &c)
 Replace the sub-expression at the iterator position with a (deep) copy of c. More...
 
Access
coeffget_coeff () const
 Returns a (modifiable) reference to the coefficient of a constant node. More...
 
ap_dim_t & get_dim () const
 Returns a (modifiable) reference to the dimension of a dimension node. More...
 
ap_texpr_op_t & get_op () const
 Returns a (modifiable) reference to the operator kind of an operator node. More...
 
ap_texpr_rtype_t & get_rtype () const
 Returns a (modifiable) reference to the destination type of an operator node. More...
 
ap_texpr_rdir_t & get_rdir () const
 Returns a (modifiable) reference to the rounding direction of an operator node. More...
 
Traversal
iteratoroperator= (const iterator &i)
 Resets the iterator at position i. More...
 
iterator child () const
 Constructs an iterator to the only or left sub-expression of an operator node. More...
 
iterator left () const
 Constructs an iterator to the only of left sub-expression of an operator node. More...
 
iterator right () const
 Constructs an iterator to the right sub-expression argument of a binary operator node. More...
 
C API compatibility
ap_texpr0_t * get_ap_texpr0_t ()
 Returns a pointer to the internal APRON object stored in *this. More...
 
const ap_texpr0_t * get_ap_texpr0_t () const
 Returns a pointer to the internal APRON object stored in *this. More...
 
- Public Member Functions inherited from apron::texpr0::const_iterator
 const_iterator (const texpr0 &e)
 Starts a new const_iterator at the root of a constant expression tree. More...
 
 const_iterator (const const_iterator &i)
 Duplicates the const_iterator. More...
 
ap_texpr_discr_t get_discr () const
 Returns the node kind. More...
 
const coeffget_coeff () const
 Returns a reference to the coefficient of a constant node. More...
 
ap_dim_t get_dim () const
 Returns the dimension of a dimension node. More...
 
ap_texpr_op_t get_op () const
 Returns the operator kind of an operator node. More...
 
ap_texpr_rtype_t get_rtype () const
 Returns the destination type of an operator node. More...
 
ap_texpr_rdir_t get_rdir () const
 Returns the rounding direction of an operator node. More...
 
const_iteratoroperator= (const const_iterator &i)
 Resets the const_iterator at position i. More...
 
const_iterator child () const
 Constructs a const_iterator to the only or left sub-expression of an operator node. More...
 
const_iterator left () const
 Constructs a const_iterator to the only of left sub-expression of an operator node. More...
 
const_iterator right () const
 Constructs a const_iterator to the right sub-expression argument of a binary operator node. More...
 
bool equal (const texpr0 &x) const
 Whether two expressions are syntactically, structurally equal. More...
 
bool is_zero () const
 Whether the expression is a single coefficient node with 0 value. More...
 
size_t depth () const
 Returns the depth of the expression tree (counting only operator nodes). More...
 
size_t size () const
 Returns the number of operator nodes in the expression tree. More...
 
ap_dim_t max_dim () const
 Returns the maximal dimension occurring in the expression (or 0 if there is no variable). More...
 
bool has_dim (ap_dim_t d) const
 Whether the given dimension occurs in the expression. More...
 
std::vector< ap_dim_t > dimlist () const
 Returns a list of all dimensions occurring in the expression (in strict increasing order) More...
 
bool is_interval_cst () const
 Whether the expression is constant (i.e., has no dimension leaves). More...
 
bool is_interval_linear () const
 Whether the expression is linear and there is no rounding. More...
 
bool is_interval_polynomial () const
 Whether the expression is polynomial and there is no rounding. More...
 
bool is_interval_polyfrac () const
 Whether the expression is a polynomial fraction and there is no rounding. More...
 
bool is_scalar () const
 Whether all occurring constants are scalar. More...
 
ap_texpr0_t * get_ap_texpr0_t ()
 Returns a pointer to the internal APRON object stored in *this. More...
 
const ap_texpr0_t * get_ap_texpr0_t () const
 Returns a pointer to the internal APRON object stored in *this. More...
 
void print (char **name_of_dim=NULL, FILE *stream=stdout) const
 Prints to a C stream. More...
 

Protected Member Functions

 iterator (ap_texpr0_t *l)
 Internal use only. More...
 
- Protected Member Functions inherited from apron::texpr0::const_iterator
 const_iterator (ap_texpr0_t *l)
 Internal use only. More...
 

Additional Inherited Members

- Protected Attributes inherited from apron::texpr0::const_iterator
ap_texpr0_t * l
 

Detailed Description

Iterators to traverse and mutate an expression tree.

As const_iterator, but can be used to modify as well as traverse nodes.

Constructor & Destructor Documentation

◆ iterator() [1/3]

texpr0::iterator::iterator ( ap_texpr0_t *  l)
inlineprotected

Internal use only.

◆ iterator() [2/3]

texpr0::iterator::iterator ( texpr0 e)
inline

Starts a new iterator at the root of the tree.

◆ iterator() [3/3]

texpr0::iterator::iterator ( const iterator i)
inline

Duplicates the iterator.

Member Function Documentation

◆ child()

texpr0::iterator texpr0::iterator::child ( ) const
inline

Constructs an iterator to the only or left sub-expression of an operator node.

Exceptions
bad_discriminantif the node is not an operator node.

◆ get_ap_texpr0_t() [1/2]

ap_texpr0_t * texpr0::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::iterator::get_ap_texpr0_t ( ) const
inline

Returns a pointer to the internal APRON object stored in *this.

◆ get_coeff()

coeff & texpr0::iterator::get_coeff ( ) const
inline

Returns a (modifiable) reference to the coefficient of a constant node.

Exceptions
bad_discriminantif the node is not a constant leaf.

◆ get_dim()

ap_dim_t & texpr0::iterator::get_dim ( ) const
inline

Returns a (modifiable) reference to the dimension of a dimension node.

Exceptions
bad_discriminantif the node is not a dimension node.

◆ get_op()

ap_texpr_op_t & texpr0::iterator::get_op ( ) const
inline

Returns a (modifiable) reference to 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
bad_discriminantif the node is not an operator node.

◆ get_rdir()

ap_texpr_rdir_t & texpr0::iterator::get_rdir ( ) const
inline

Returns a (modifiable) reference to 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
bad_discriminantif the node is not an operator node.

◆ get_rtype()

ap_texpr_rtype_t & texpr0::iterator::get_rtype ( ) const
inline

Returns a (modifiable) reference to 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
bad_discriminantif the node is not an operator node.

◆ left()

texpr0::iterator texpr0::iterator::left ( ) const
inline

Constructs an iterator to the only of left sub-expression of an operator node.

(Identical to child()).

Exceptions
bad_discriminantif the node is not an operator node.

◆ operator=() [1/2]

texpr0::iterator & texpr0::iterator::operator= ( const builder c)
inline

Replace the sub-expression at the iterator position with a (deep) copy of c.

The iterator is still valid after substitution (it points to the sub-expression copy). However, any iterator in the discarded part becomes invalid.

◆ operator=() [2/2]

texpr0::iterator & texpr0::iterator::operator= ( const iterator i)
inline

Resets the iterator at position i.

◆ right()

texpr0::iterator texpr0::iterator::right ( ) const
inline

Constructs an iterator to the right sub-expression argument of a binary operator node.

Exceptions
bad_discriminantif the node is not an operator node.
std::out_of_rangeif the operator node is not binary.

The documentation for this class was generated from the following files: