APRONXX  0.9.12
Protected Member Functions | Protected Attributes | List of all members
apron::texpr1::const_iterator Class Reference

Iterators to traverse a constant expression tree. More...

#include <apxx_texpr1.hh>

Inherited by apron::texpr1::iterator.

Public Member Functions

Constructors
 const_iterator (const texpr1 &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...
 
Access
environment get_environment () const
 Returns (a copy of) the environment associated with the expression. More...
 
texpr0::const_iterator get_texpr0 () const
 Returns a constant iterator at the root of the underlying texpr0. 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...
 
const varget_var () const
 Returns a (unmodifiable) reference to the variable name of a dimension 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...
 
Traversal
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...
 
Tests, size, dimensions
bool equal (const texpr1 &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...
 
bool has_var (const var &v) const
 Whether the given variable name occurs in the expression. 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...
 
C API compatibility
ap_texpr1_t * get_ap_texpr1_t ()
 Returns a pointer to the internal APRON object stored in *this. More...
 
const ap_texpr1_t * get_ap_texpr1_t () const
 Returns a pointer to the internal APRON object stored in *this. More...
 

Protected Member Functions

 const_iterator (ap_texpr1_t *l)
 Internal use only. More...
 
 const_iterator (ap_texpr0_t *t, ap_environment_t *e)
 Internal use only. More...
 

Protected Attributes

ap_texpr1_t l
 

Printing

std::ostream & operator<< (std::ostream &os, const const_iterator &s)
 Printing. More...
 
void print (FILE *stream=stdout) const
 Prints to a C stream. More...
 

Detailed Description

Iterators to traverse a constant expression tree.

Use the iterator class if you also wish to mutate an expression.

Constructor & Destructor Documentation

◆ const_iterator() [1/4]

texpr1::const_iterator::const_iterator ( ap_texpr1_t *  l)
inlineprotected

Internal use only.

◆ const_iterator() [2/4]

apron::texpr1::const_iterator::const_iterator ( ap_texpr0_t *  t,
ap_environment_t *  e 
)
inlineprotected

Internal use only.

◆ const_iterator() [3/4]

texpr1::const_iterator::const_iterator ( const texpr1 e)
inline

Starts a new const_iterator at the root of a constant expression tree.

◆ const_iterator() [4/4]

texpr1::const_iterator::const_iterator ( const const_iterator i)
inline

Duplicates the const_iterator.

Member Function Documentation

◆ child()

texpr1::const_iterator texpr1::const_iterator::child ( ) const
inline

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

Exceptions
bad_discriminantif the node is not an operator node.

◆ depth()

size_t texpr1::const_iterator::depth ( ) const
inline

Returns the depth of the expression tree (counting only operator nodes).

◆ equal()

bool texpr1::const_iterator::equal ( const texpr1 x) const
inline

Whether two expressions are syntactically, structurally equal.

◆ get_ap_texpr1_t() [1/2]

ap_texpr1_t * texpr1::const_iterator::get_ap_texpr1_t ( )
inline

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

◆ get_ap_texpr1_t() [2/2]

const ap_texpr1_t * texpr1::const_iterator::get_ap_texpr1_t ( ) const
inline

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

◆ get_coeff()

const coeff & texpr1::const_iterator::get_coeff ( ) const
inline

Returns a reference to the coefficient of a constant node.

Exceptions
bad_discriminantif the node is not a constant leaf.

◆ get_dim()

ap_dim_t texpr1::const_iterator::get_dim ( ) const
inline

Returns the dimension of a dimension node.

Exceptions
bad_discriminantif the node is not a dimension node.

◆ get_discr()

ap_texpr_discr_t texpr1::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_environment()

environment texpr1::const_iterator::get_environment ( ) const
inline

Returns (a copy of) the environment associated with the expression.

◆ get_op()

ap_texpr_op_t texpr1::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
bad_discriminantif the node is not an operator node.

◆ get_rdir()

ap_texpr_rdir_t texpr1::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
bad_discriminantif the node is not an operator node.

◆ get_rtype()

ap_texpr_rtype_t texpr1::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
bad_discriminantif the node is not an operator node.

◆ get_texpr0()

texpr0::const_iterator texpr1::const_iterator::get_texpr0 ( ) const
inline

Returns a constant iterator at the root of the underlying texpr0.

◆ get_var()

const var & texpr1::const_iterator::get_var ( ) const
inline

Returns a (unmodifiable) reference to the variable name of a dimension node.

Exceptions
bad_discriminantif the node is not a dimension node.

◆ has_var()

bool texpr1::const_iterator::has_var ( const var v) const
inline

Whether the given variable name occurs in the expression.

◆ is_interval_cst()

bool texpr1::const_iterator::is_interval_cst ( ) const
inline

Whether the expression is constant (i.e., has no dimension leaves).

◆ is_interval_linear()

bool texpr1::const_iterator::is_interval_linear ( ) const
inline

Whether the expression is linear and there is no rounding.

◆ is_interval_polyfrac()

bool texpr1::const_iterator::is_interval_polyfrac ( ) const
inline

Whether the expression is a polynomial fraction and there is no rounding.

◆ is_interval_polynomial()

bool texpr1::const_iterator::is_interval_polynomial ( ) const
inline

Whether the expression is polynomial and there is no rounding.

◆ is_scalar()

bool texpr1::const_iterator::is_scalar ( ) const
inline

Whether all occurring constants are scalar.

◆ is_zero()

bool texpr1::const_iterator::is_zero ( ) const
inline

Whether the expression is a single coefficient node with 0 value.

◆ left()

texpr1::const_iterator texpr1::const_iterator::left ( ) const
inline

Constructs a const_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=()

texpr1::const_iterator & texpr1::const_iterator::operator= ( const const_iterator i)
inline

Resets the const_iterator at position i.

◆ print()

void texpr1::const_iterator::print ( FILE *  stream = stdout) const
inline

Prints to a C stream.

◆ right()

texpr1::const_iterator texpr1::const_iterator::right ( ) const
inline

Constructs a const_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.

◆ size()

size_t texpr1::const_iterator::size ( ) const
inline

Returns the number of operator nodes in the expression tree.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const const_iterator s 
)
friend

Printing.

Member Data Documentation

◆ l

ap_texpr1_t apron::texpr1::const_iterator::l
protected

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