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

Level 1 arbitrary expression tree (ap_texpr1_t wrapper). More...

#include <apxx_texpr1.hh>

Inherits apron::use_malloc.

Classes

class  builder
 Temporary expression nodes used when constructing a texpr1. More...
 
class  const_iterator
 Iterators to traverse a constant expression tree. More...
 
class  iterator
 Iterators to traverse and mutate an expression tree. More...
 

Public Member Functions

Constructors
 texpr1 (const builder &c)
 Makes an expression from a temporary. More...
 
 texpr1 (const const_iterator &x)
 Makes a (deep) copy of the expression tree. More...
 
 texpr1 (const texpr1 &x)
 Makes a (deep) copy of the expression tree. More...
 
 texpr1 (const environment &e, const var &v)
 Makes a variable name dimension leaf. More...
 
 texpr1 (const environment &e, const texpr0::const_iterator &x)
 Makes a (deep) copy of the level 0 expression tree and associates an environment (increments reference count). More...
 
 texpr1 (const environment &e, const texpr0 &x)
 Makes a (deep) copy of the level 0 expression tree and associates an environment (increments reference count). More...
 
 texpr1 (const environment &e, const texpr0::builder &c)
 Makes an expression from a level 0 temporary. More...
 
 texpr1 (const linexpr1 &l)
 Makes an expression tree from a linear expression (copying coefficients). More...
 
 texpr1 (const texpr1 &x, const environment &e)
 Makes a (deep) copy of x and extends its environment. More...
 
 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 of the dst expression. More...
 
Destructor
 ~texpr1 ()
 Frees the memory occupied by the expression and decrements the reference count of the environment. More...
 
Assignments
texpr1operator= (const texpr1 &x)
 Makes a (deep) copy of the expression. More...
 
texpr1operator= (const const_iterator &x)
 Makes a (deep) copy of the expression. More...
 
texpr1operator= (const builder &x)
 Assigns from a temporary expression, performing a deep copy and deleting the previous value of *this. More...
 
texpr1operator= (const linexpr1 &x)
 Makes *this equal to the linear expression x (coefficients are copied), deleting the previous value of *this. More...
 
Iterators
const_iterator root () const
 Returns a new iterator at the root of a constant expression tree. More...
 
iterator root ()
 Returns a new iterator at the root of a mutable expression tree. More...
 
Dimension operations
void extend_environment (const environment &e)
 Extends the environment of the expression. More...
 
Accesses, tests, size
environment get_environment () const
 Returns the environment of the expression (with incremented reference count). More...
 
texpr0::const_iterator get_texpr0 () const
 Returns a constant iterator at the root of the underlying texpr0. More...
 
texpr0::iterator get_texpr0 ()
 Returns an iterator at the root of the underlying texpr0. More...
 
bool is_zero () const
 Whether the expression is a single coefficient node with 0 value. More...
 
bool equal (const texpr1 &x) const
 Whether two expressions are syntactically, structurally equal. 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...
 
Operations
void substitute (const var &src, const texpr1 &dst)
 Substitutes each occurrence of src with (a fresh copy of) dst. 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...
 
- Public Member Functions inherited from apron::use_malloc
void * operator new (size_t sz)
 
void * operator new[] (size_t sz)
 
void operator delete (void *p)
 
void operator delete[] (void *p)
 

Protected Member Functions

 texpr1 (ap_texpr1_t *x)
 Internal use only. Shallow copy. More...
 
void init_from (ap_environment_t *e, ap_texpr0_t *x)
 Internal use only. Shallow copy. More...
 
void init_from (ap_texpr1_t *x)
 Internal use only. Shallow copy. More...
 

Protected Attributes

ap_texpr1_t l
 Structure managed by APRON. More...
 

Printing

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

Detailed Description

Level 1 arbitrary expression tree (ap_texpr1_t wrapper).

Level 1 version of arbitrary expression trees (texpr0). Variable names (var) are used instead of dimensions (ap_dim_t). Internally, a texpr1 wraps together a texpr0 (memory managed) and an environment (holding a reference count).

There are also level 1 equivalent of the helper classes: builder, iterator, and const_iterator.

Constructor & Destructor Documentation

◆ texpr1() [1/11]

texpr1::texpr1 ( ap_texpr1_t *  x)
inlineprotected

Internal use only. Shallow copy.

◆ texpr1() [2/11]

apron::texpr1::texpr1 ( const builder c)
inline

Makes an expression from a temporary.

◆ texpr1() [3/11]

texpr1::texpr1 ( const const_iterator x)
inline

Makes a (deep) copy of the expression tree.

◆ texpr1() [4/11]

texpr1::texpr1 ( const texpr1 x)
inline

Makes a (deep) copy of the expression tree.

◆ texpr1() [5/11]

texpr1::texpr1 ( const environment e,
const var v 
)
inline

Makes a variable name dimension leaf.

Exceptions
std::invalid_argumentif the environment does not contain the variable.

◆ texpr1() [6/11]

texpr1::texpr1 ( const environment e,
const texpr0::const_iterator x 
)
inline

Makes a (deep) copy of the level 0 expression tree and associates an environment (increments reference count).

◆ texpr1() [7/11]

texpr1::texpr1 ( const environment e,
const texpr0 x 
)
inline

Makes a (deep) copy of the level 0 expression tree and associates an environment (increments reference count).

◆ texpr1() [8/11]

texpr1::texpr1 ( const environment e,
const texpr0::builder c 
)
inline

Makes an expression from a level 0 temporary.

◆ texpr1() [9/11]

texpr1::texpr1 ( const linexpr1 l)
inline

Makes an expression tree from a linear expression (copying coefficients).

Real-valued addition and multiplication operators are used (i.e., no rounding).

◆ texpr1() [10/11]

texpr1::texpr1 ( const texpr1 x,
const environment e 
)
inline

Makes a (deep) copy of x and extends its environment.

Exceptions
std::invalid_argumentif e is not a super-environment of that of x.

◆ texpr1() [11/11]

texpr1::texpr1 ( const texpr1 x,
const var src,
const texpr1 dst 
)
inline

Makes a (deep) copy of x and substitutes every occurrence of the src variable name with a fresh copy of the dst expression.

Exceptions
std::invalid_argumentif the environments are not equal or do not contain the variable.

◆ ~texpr1()

texpr1::~texpr1 ( )
inline

Frees the memory occupied by the expression and decrements the reference count of the environment.

Member Function Documentation

◆ depth()

size_t texpr1::depth ( ) const
inline

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

◆ equal()

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

Whether two expressions are syntactically, structurally equal.

◆ extend_environment()

void texpr1::extend_environment ( const environment e)
inline

Extends the environment of the expression.

Exceptions
std::invalid_argumentif e is not a super-environment of that of *this.

◆ get_ap_texpr1_t() [1/2]

ap_texpr1_t * texpr1::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::get_ap_texpr1_t ( ) const
inline

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

◆ get_environment()

environment texpr1::get_environment ( ) const
inline

Returns the environment of the expression (with incremented reference count).

◆ get_texpr0() [1/2]

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

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

◆ get_texpr0() [2/2]

texpr0::iterator texpr1::get_texpr0 ( )
inline

Returns an iterator at the root of the underlying texpr0.

◆ has_var()

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

Whether the given variable name occurs in the expression.

◆ init_from() [1/2]

void texpr1::init_from ( ap_environment_t *  e,
ap_texpr0_t *  x 
)
inlineprotected

Internal use only. Shallow copy.

◆ init_from() [2/2]

void texpr1::init_from ( ap_texpr1_t *  x)
inlineprotected

Internal use only. Shallow copy.

◆ is_interval_cst()

bool texpr1::is_interval_cst ( ) const
inline

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

◆ is_interval_linear()

bool texpr1::is_interval_linear ( ) const
inline

Whether the expression is linear and there is no rounding.

◆ is_interval_polyfrac()

bool texpr1::is_interval_polyfrac ( ) const
inline

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

◆ is_interval_polynomial()

bool texpr1::is_interval_polynomial ( ) const
inline

Whether the expression is polynomial and there is no rounding.

◆ is_scalar()

bool texpr1::is_scalar ( ) const
inline

Whether all occurring constants are scalar.

◆ is_zero()

bool texpr1::is_zero ( ) const
inline

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

◆ operator=() [1/4]

texpr1 & texpr1::operator= ( const texpr1 x)
inline

Makes a (deep) copy of the expression.

◆ operator=() [2/4]

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

Makes a (deep) copy of the expression.

◆ operator=() [3/4]

texpr1 & texpr1::operator= ( const builder x)
inline

Assigns from a temporary expression, performing a deep copy and deleting the previous value of *this.

◆ operator=() [4/4]

texpr1 & texpr1::operator= ( const linexpr1 x)
inline

Makes *this equal to the linear expression x (coefficients are copied), deleting the previous value of *this.

Real-valued addition and multiplication operators are used (i.e., no rounding).

◆ print()

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

Prints to a C stream.

◆ root() [1/2]

texpr1::const_iterator texpr1::root ( ) const
inline

Returns a new iterator at the root of a constant expression tree.

◆ root() [2/2]

texpr1::iterator texpr1::root ( )
inline

Returns a new iterator at the root of a mutable expression tree.

◆ size()

size_t texpr1::size ( ) const
inline

Returns the number of operator nodes in the expression tree.

◆ substitute()

void texpr1::substitute ( const var src,
const texpr1 dst 
)
inline

Substitutes each occurrence of src with (a fresh copy of) dst.

Exceptions
std::invalid_argumentif the environments are not equal or do not contain src.

Friends And Related Function Documentation

◆ operator<<

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

Printing.

Member Data Documentation

◆ l

ap_texpr1_t apron::texpr1::l
protected

Structure managed by APRON.


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