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

Iterator to traverse a constant linexpr1. More...

#include <apxx_linexpr1.hh>

Inherited by apron::linexpr1::iterator.

Public Member Functions

 const_iterator (const linexpr1 &e)
 Starts a new iterator to traverse the linear expression. More...
 
 const_iterator (const const_iterator &i)
 Duplicates the iterator. More...
 
const_iteratoroperator= (const const_iterator &i)
 Assigns the iterator. More...
 
const varget_var () const
 Returns the variable name of the coefficient at the current iterator position. More...
 
ap_dim_t get_dim () const
 Returns the dimension of the coefficient at the current iterator position. More...
 
const coeffget_coeff () const
 Returns a reference to the coefficient at the current iterator position. More...
 
void next ()
 Moves the iterator to the following position. More...
 
void operator++ ()
 Moves the iterator to the following position. More...
 
bool valid () const
 Whether we are at a valid position (true) or past the last iterator position (false). More...
 

Protected Member Functions

void skip_AP_DIM_MAX ()
 Internal use only. Skips free coefficients in sparse expressions. More...
 
 const_iterator (ap_linexpr1_t *l)
 Internal use only. More...
 

Protected Attributes

ap_linexpr1_t * l
 Internal use only. Pointer to the underlying APRON structure. More...
 
ap_dim_t pos
 Internal use only. Current index. More...
 

Detailed Description

Iterator to traverse a constant linexpr1.

At each position, there is variable name and its corresponding coefficients. The expression is traversed in increasing order of integer variable names followed by real variable names also in increasing order.

To mutate a linear expression, use the iterator class instead.

Sample code:

for (linexpr1::const_iterator i = m.begin();i.valid();++i) cout << i.get_coeff() << " ";

Constructor & Destructor Documentation

◆ const_iterator() [1/3]

apron::linexpr1::const_iterator::const_iterator ( ap_linexpr1_t *  l)
inlineprotected

Internal use only.

◆ const_iterator() [2/3]

linexpr1::const_iterator::const_iterator ( const linexpr1 e)
inline

Starts a new iterator to traverse the linear expression.

◆ const_iterator() [3/3]

linexpr1::const_iterator::const_iterator ( const const_iterator i)
inline

Duplicates the iterator.

Member Function Documentation

◆ get_coeff()

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

Returns a reference to the coefficient at the current iterator position.

Exceptions
std::out_of_rangeif valid() returns false (we are past the last position).

◆ get_dim()

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

Returns the dimension of the coefficient at the current iterator position.

Exceptions
std::out_of_rangeif valid() returns false (we are past the last position).

◆ get_var()

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

Returns the variable name of the coefficient at the current iterator position.

Exceptions
std::out_of_rangeif valid() returns false (we are past the last position).

◆ next()

void linexpr1::const_iterator::next ( )
inline

Moves the iterator to the following position.

◆ operator++()

void linexpr1::const_iterator::operator++ ( )
inline

Moves the iterator to the following position.

(Identical to next()).

◆ operator=()

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

Assigns the iterator.

◆ skip_AP_DIM_MAX()

void linexpr1::const_iterator::skip_AP_DIM_MAX ( )
inlineprotected

Internal use only. Skips free coefficients in sparse expressions.

◆ valid()

bool linexpr1::const_iterator::valid ( ) const
inline

Whether we are at a valid position (true) or past the last iterator position (false).

Member Data Documentation

◆ l

ap_linexpr1_t* apron::linexpr1::const_iterator::l
protected

Internal use only. Pointer to the underlying APRON structure.

◆ pos

ap_dim_t apron::linexpr1::const_iterator::pos
protected

Internal use only. Current index.


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