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

Temporary expression nodes used when constructing a texpr0. More...

#include <apxx_texpr0.hh>

Inherits apron::use_malloc.

Public Member Functions

bool is_zero () const
 Whether the expression is a single coefficient node with 0 value. More...
 
Constructors
 builder (const builder &x)
 Makes a shallow copy, copying only the root node. Sub-expressions are aliased, not copied. More...
 
 builder (const const_iterator &x)
 Makes a shallow copy, copying only the root node. Sub-expressions are aliased, not copied. More...
 
 builder (const texpr0 &x)
 Makes a shallow copy, copying only the root node. Sub-expressions are aliased, not copied. More...
 
 builder (const coeff &x)
 Makes a constant leaf from a scalar or interval coefficient (copied). More...
 
 builder (const scalar &x)
 Makes a constant scalar leaf from a scalar (copied). More...
 
 builder (const mpq_class &x)
 Makes a constant scalar leaf from a MPQ (copied). More...
 
 builder (mpfr_t x)
 Makes a constant scalar leaf from a MPFR (copied). More...
 
 builder (int x)
 Makes a constant scalar MPQ leaf from an integer. More...
 
 builder (long x)
 Makes a constant scalar MPQ leaf from an integer. More...
 
 builder (double x)
 Makes a constant scalar double leaf from a double. More...
 
 builder (const frac &x)
 Makes a constant scalar MPQ leaf from a fraction with integer coefficients. More...
 
 builder (const interval &x)
 Makes a constant interval leaf from an interval (copied). More...
 
 builder (const scalar &inf, const scalar &sup)
 Makes a constant interval leaf from two scalar bounds (copied). More...
 
 builder (const mpq_class &inf, const mpq_class &sup)
 Makes a constant interval leaf from two MPQ bounds (copied). More...
 
 builder (mpfr_t inf, mpfr_t sup)
 Makes a constant interval leaf from two MPFR bounds (copied). More...
 
 builder (int inf, int sup)
 Makes a constant interval leaf from two integer bounds (converted to MPQ). More...
 
 builder (long inf, long sup)
 Makes a constant interval leaf from two integer bounds (converted to MPQ). More...
 
 builder (double inf, double sup)
 Makes a constant interval leaf from two double bounds. More...
 
 builder (const frac &inf, const frac &sup)
 Makes a constant interval leaf from two fraction bounds (converted to MPQ). More...
 
 builder (top t)
 Makes a constant interval leaf equal to ]-oo;+oo[. More...
 
 builder (dim d)
 Makes a dimension leaf (i.e., variable of specified index). More...
 
 builder (ap_texpr_op_t op, const builder &argA, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
 Makes a unary expression node. More...
 
 builder (ap_texpr_op_t op, const builder &argA, const builder &argB, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
 Makes a binary expression node. More...
 
Destructor
 ~builder ()
 Frees the memory occupied by the node, not its sub-expressions. 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::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

builderoperator= (const builder &x)
 Not to be used. (Temporaries are not to be re-assigned). More...
 
void init_from (ap_texpr0_t *x)
 Internal use only: makes a shallow copy, copying only the root node. More...
 
 builder (ap_texpr0_t *x)
 Internal use only: makes a shallow copy, copying only the root node. More...
 

Protected Attributes

ap_texpr0_t * l
 

Friends

'Intelligent' constructors
builder unary (ap_texpr_op_t op, const builder &a, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
 Makes a unary expression node. More...
 
builder binary (ap_texpr_op_t op, const builder &a, const builder &b, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
 Makes a binary expression node. More...
 
builder add (const builder &a, const builder &b, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
 Makes an AP_TEXPR_ADD expression node. More...
 
builder sub (const builder &a, const builder &b, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
 Makes an AP_TEXPR_SUB expression node. More...
 
builder mul (const builder &a, const builder &b, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
 Makes an AP_TEXPR_MUL expression node. More...
 
builder div (const builder &a, const builder &b, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
 Makes an AP_TEXPR_DIV expression node. More...
 
builder mod (const builder &a, const builder &b, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
 Makes an AP_TEXPR_MOD expression node. More...
 
builder pow (const builder &a, const builder &b, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
 Makes an AP_TEXPR_POW expression node. More...
 
builder neg (const builder &a, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
 Makes an AP_TEXPR_NEG expression node. More...
 
builder cast (const builder &a, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
 Makes an AP_TEXPR_CAST expression node. More...
 
builder floor (const builder &a)
 Makes an AP_TEXPR_CAST expression node to AP_RTYPE_INT type rounded towards AP_RDIR_DOWN. More...
 
builder ceil (const builder &a)
 Makes an AP_TEXPR_CAST expression node to AP_RTYPE_INT type rounded towards AP_RDIR_UP. More...
 
builder trunc (const builder &a)
 Makes an AP_TEXPR_CAST expression node to AP_RTYPE_INT type rounded towards AP_RDIR_ZERO. More...
 
builder sqrt (const builder &a, ap_texpr_rtype_t rtype, ap_texpr_rdir_t rdir)
 Makes an AP_TEXPR_SQRT expression node. More...
 
builder operator+ (const builder &a)
 Makes a copy of the node. More...
 
builder operator- (const builder &a)
 Makes a AP_TEXPR_NEG expression node using AP_RTYPE_REAL type (no rounding). More...
 
builder operator+ (const builder &a, const builder &b)
 Makes a AP_TEXPR_ADD expression node using AP_RTYPE_REAL type (no rounding). More...
 
builder operator- (const builder &a, const builder &b)
 Makes a AP_TEXPR_SUB expression node using AP_RTYPE_REAL type (no rounding). More...
 
builder operator * (const builder &a, const builder &b)
 Makes a AP_TEXPR_MUL expression node using AP_RTYPE_REAL type (no rounding). More...
 
builder operator/ (const builder &a, const builder &b)
 Makes a AP_TEXPR_DIV expression node using AP_RTYPE_REAL type (no rounding). More...
 
builder operator% (const builder &a, const builder &b)
 Makes a AP_TEXPR_MOD expression node using AP_RTYPE_REAL type (no rounding). More...
 
builder operator^ (const builder &a, const builder &b)
 Makes a AP_TEXPR_POW expression node using AP_RTYPE_REAL type (no rounding). More...
 

Detailed Description

Temporary expression nodes used when constructing a texpr0.

Builders allow constructing expression trees one node at a time using overloaded operators (+, -, *, /, %) and friend functions (add, sub, mul, div, mod, neg, sqrt, cast, unary, binary).

Each builder object manages a single node which is allocated by the constructor and destroyed by the destructor, without considering potential sub-nodes. As their usage is temporary (they are normally destructed at the end of full expressions), assignment, copy, and destruction can be shallow, which results in improved efficiency wrt. using texpr0 as temporaries.

You should not create variables of type build, nor define functions that return or take builder objects as arguments.

Constructor & Destructor Documentation

◆ builder() [1/24]

texpr0::builder::builder ( ap_texpr0_t *  x)
inlineprotected

Internal use only: makes a shallow copy, copying only the root node.

◆ builder() [2/24]

texpr0::builder::builder ( const builder x)
inline

Makes a shallow copy, copying only the root node. Sub-expressions are aliased, not copied.

◆ builder() [3/24]

texpr0::builder::builder ( const const_iterator x)
inline

Makes a shallow copy, copying only the root node. Sub-expressions are aliased, not copied.

◆ builder() [4/24]

texpr0::builder::builder ( const texpr0 x)
inline

Makes a shallow copy, copying only the root node. Sub-expressions are aliased, not copied.

◆ builder() [5/24]

texpr0::builder::builder ( const coeff x)
inline

Makes a constant leaf from a scalar or interval coefficient (copied).

◆ builder() [6/24]

texpr0::builder::builder ( const scalar x)
inline

Makes a constant scalar leaf from a scalar (copied).

◆ builder() [7/24]

texpr0::builder::builder ( const mpq_class &  x)
inline

Makes a constant scalar leaf from a MPQ (copied).

◆ builder() [8/24]

texpr0::builder::builder ( mpfr_t  x)
inline

Makes a constant scalar leaf from a MPFR (copied).

◆ builder() [9/24]

texpr0::builder::builder ( int  x)
inline

Makes a constant scalar MPQ leaf from an integer.

◆ builder() [10/24]

texpr0::builder::builder ( long  x)
inline

Makes a constant scalar MPQ leaf from an integer.

◆ builder() [11/24]

texpr0::builder::builder ( double  x)
inline

Makes a constant scalar double leaf from a double.

◆ builder() [12/24]

texpr0::builder::builder ( const frac x)
inline

Makes a constant scalar MPQ leaf from a fraction with integer coefficients.

◆ builder() [13/24]

texpr0::builder::builder ( const interval x)
inline

Makes a constant interval leaf from an interval (copied).

◆ builder() [14/24]

texpr0::builder::builder ( const scalar inf,
const scalar sup 
)
inline

Makes a constant interval leaf from two scalar bounds (copied).

◆ builder() [15/24]

texpr0::builder::builder ( const mpq_class &  inf,
const mpq_class &  sup 
)
inline

Makes a constant interval leaf from two MPQ bounds (copied).

◆ builder() [16/24]

texpr0::builder::builder ( mpfr_t  inf,
mpfr_t  sup 
)
inline

Makes a constant interval leaf from two MPFR bounds (copied).

◆ builder() [17/24]

texpr0::builder::builder ( int  inf,
int  sup 
)
inline

Makes a constant interval leaf from two integer bounds (converted to MPQ).

◆ builder() [18/24]

texpr0::builder::builder ( long  inf,
long  sup 
)
inline

Makes a constant interval leaf from two integer bounds (converted to MPQ).

◆ builder() [19/24]

texpr0::builder::builder ( double  inf,
double  sup 
)
inline

Makes a constant interval leaf from two double bounds.

◆ builder() [20/24]

texpr0::builder::builder ( const frac inf,
const frac sup 
)
inline

Makes a constant interval leaf from two fraction bounds (converted to MPQ).

◆ builder() [21/24]

texpr0::builder::builder ( top  t)
inline

Makes a constant interval leaf equal to ]-oo;+oo[.

◆ builder() [22/24]

texpr0::builder::builder ( dim  d)
inline

Makes a dimension leaf (i.e., variable of specified index).

◆ builder() [23/24]

texpr0::builder::builder ( ap_texpr_op_t  op,
const builder argA,
ap_texpr_rtype_t  rtype,
ap_texpr_rdir_t  rdir 
)
inline

Makes a unary expression node.

◆ builder() [24/24]

texpr0::builder::builder ( ap_texpr_op_t  op,
const builder argA,
const builder argB,
ap_texpr_rtype_t  rtype,
ap_texpr_rdir_t  rdir 
)
inline

Makes a binary expression node.

◆ ~builder()

texpr0::builder::~builder ( )
inline

Frees the memory occupied by the node, not its sub-expressions.

Member Function Documentation

◆ get_ap_texpr0_t() [1/2]

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

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

◆ init_from()

void texpr0::builder::init_from ( ap_texpr0_t *  x)
inlineprotected

Internal use only: makes a shallow copy, copying only the root node.

◆ is_zero()

bool texpr0::builder::is_zero ( ) const
inline

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

◆ operator=()

builder& apron::texpr0::builder::operator= ( const builder x)
inlineprotected

Not to be used. (Temporaries are not to be re-assigned).

Friends And Related Function Documentation

◆ add

builder add ( const builder a,
const builder b,
ap_texpr_rtype_t  rtype = AP_RTYPE_REAL,
ap_texpr_rdir_t  rdir = AP_RDIR_NEAREST 
)
friend

Makes an AP_TEXPR_ADD expression node.

◆ binary

builder binary ( ap_texpr_op_t  op,
const builder a,
const builder b,
ap_texpr_rtype_t  rtype = AP_RTYPE_REAL,
ap_texpr_rdir_t  rdir = AP_RDIR_NEAREST 
)
friend

Makes a binary expression node.

Creates only one node. The argument expressions is aliased, not copied.

  • op should be a binary operator: addition (AP_TEXPR_ADD), subtraction (AP_TEXPR_SUB), multiplication (AP_TEXPR_MUL), division (AP_TEXPR_DIV), modulo (AP_TEXPR_MOD), or power (AP_TEXPR_POW).
  • argA should point to the left argument expression.
  • argB should point to the right argument expression.
  • rtype is the destination type (for rounding): reals (AP_RTYPE_REAL, means no rounding), perfect integers (AP_RTYPE_INT), 32-bit single precision (AP_RTYPE_SINGLE), 64-bit double precision (AP_RTYPE_DOUBLE), 80-bit extended precision (AP_RTYPE_EXTENDED).
  • rdir is the rounding direction: to nearest (AP_RDIR_NEAREST), truncation (AP_RDIR_ZERO), towards +oo (AP_RDIR_UP), towards -oo (AP_RDIR_DOWN), or non-deterministic (AP_RDIR_RND).
    Exceptions
    std::invalid_argumentif op is not a binary operator.

◆ cast

builder cast ( const builder a,
ap_texpr_rtype_t  rtype,
ap_texpr_rdir_t  rdir = AP_RDIR_NEAREST 
)
friend

Makes an AP_TEXPR_CAST expression node.

◆ ceil

builder ceil ( const builder a)
friend

Makes an AP_TEXPR_CAST expression node to AP_RTYPE_INT type rounded towards AP_RDIR_UP.

◆ div

builder div ( const builder a,
const builder b,
ap_texpr_rtype_t  rtype = AP_RTYPE_REAL,
ap_texpr_rdir_t  rdir = AP_RDIR_NEAREST 
)
friend

Makes an AP_TEXPR_DIV expression node.

◆ floor

builder floor ( const builder a)
friend

Makes an AP_TEXPR_CAST expression node to AP_RTYPE_INT type rounded towards AP_RDIR_DOWN.

◆ mod

builder mod ( const builder a,
const builder b,
ap_texpr_rtype_t  rtype = AP_RTYPE_REAL,
ap_texpr_rdir_t  rdir = AP_RDIR_NEAREST 
)
friend

Makes an AP_TEXPR_MOD expression node.

◆ mul

builder mul ( const builder a,
const builder b,
ap_texpr_rtype_t  rtype = AP_RTYPE_REAL,
ap_texpr_rdir_t  rdir = AP_RDIR_NEAREST 
)
friend

Makes an AP_TEXPR_MUL expression node.

◆ neg

builder neg ( const builder a,
ap_texpr_rtype_t  rtype = AP_RTYPE_REAL,
ap_texpr_rdir_t  rdir = AP_RDIR_NEAREST 
)
friend

Makes an AP_TEXPR_NEG expression node.

◆ operator *

builder operator * ( const builder a,
const builder b 
)
friend

Makes a AP_TEXPR_MUL expression node using AP_RTYPE_REAL type (no rounding).

◆ operator%

builder operator% ( const builder a,
const builder b 
)
friend

Makes a AP_TEXPR_MOD expression node using AP_RTYPE_REAL type (no rounding).

◆ operator+ [1/2]

builder operator+ ( const builder a)
friend

Makes a copy of the node.

◆ operator+ [2/2]

builder operator+ ( const builder a,
const builder b 
)
friend

Makes a AP_TEXPR_ADD expression node using AP_RTYPE_REAL type (no rounding).

◆ operator- [1/2]

builder operator- ( const builder a)
friend

Makes a AP_TEXPR_NEG expression node using AP_RTYPE_REAL type (no rounding).

◆ operator- [2/2]

builder operator- ( const builder a,
const builder b 
)
friend

Makes a AP_TEXPR_SUB expression node using AP_RTYPE_REAL type (no rounding).

◆ operator/

builder operator/ ( const builder a,
const builder b 
)
friend

Makes a AP_TEXPR_DIV expression node using AP_RTYPE_REAL type (no rounding).

◆ operator^

builder operator^ ( const builder a,
const builder b 
)
friend

Makes a AP_TEXPR_POW expression node using AP_RTYPE_REAL type (no rounding).

◆ pow

builder pow ( const builder a,
const builder b,
ap_texpr_rtype_t  rtype = AP_RTYPE_REAL,
ap_texpr_rdir_t  rdir = AP_RDIR_NEAREST 
)
friend

Makes an AP_TEXPR_POW expression node.

◆ sqrt

builder sqrt ( const builder a,
ap_texpr_rtype_t  rtype = AP_RTYPE_REAL,
ap_texpr_rdir_t  rdir = AP_RDIR_NEAREST 
)
friend

Makes an AP_TEXPR_SQRT expression node.

◆ sub

builder sub ( const builder a,
const builder b,
ap_texpr_rtype_t  rtype = AP_RTYPE_REAL,
ap_texpr_rdir_t  rdir = AP_RDIR_NEAREST 
)
friend

Makes an AP_TEXPR_SUB expression node.

◆ trunc

builder trunc ( const builder a)
friend

Makes an AP_TEXPR_CAST expression node to AP_RTYPE_INT type rounded towards AP_RDIR_ZERO.

◆ unary

builder unary ( ap_texpr_op_t  op,
const builder a,
ap_texpr_rtype_t  rtype = AP_RTYPE_REAL,
ap_texpr_rdir_t  rdir = AP_RDIR_NEAREST 
)
friend

Makes a unary expression node.

Creates only one node. The argument expression is aliased, not copied.

  • op should be a unary operator: negation (AP_TEXPR_NEG), typecast (AP_TEXPR_CAST), or square root (AP_TEXPR_SQRT).
  • argA should point to the argument expression.
  • rtype is the destination type (for rounding): reals (AP_RTYPE_REAL, means no rounding), perfect integers (AP_RTYPE_INT), 32-bit single precision (AP_RTYPE_SINGLE), 64-bit double precision (AP_RTYPE_DOUBLE), 80-bit extended precision (AP_RTYPE_EXTENDED), or 128-bit quadruple precision (AP_RTYPE_QUAD).
  • rdir is the rounding direction: to nearest (AP_RDIR_NEAREST), truncation (AP_RDIR_ZERO), towards +oo (AP_RDIR_UP), towards -oo (AP_RDIR_DOWN), or non-deterministic (AP_RDIR_RND).
    Exceptions
    std::invalid_argumentif op is not a unary operator.

Member Data Documentation

◆ l

ap_texpr0_t* apron::texpr0::builder::l
protected

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