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

Level 1 arbitrary constraint (ap_tcons1_t wrapper). More...

#include <apxx_tcons1.hh>

Inherits apron::use_malloc.

Public Member Functions

Constructors
 tcons1 (const environment &env, ap_constyp_t constyp=AP_CONS_SUPEQ)
 Creates an empty constraint. More...
 
 tcons1 (ap_constyp_t constyp, const texpr1::builder &t)
 Creates a new (non-modulo) constraint from an expression tree (copied). More...
 
 tcons1 (ap_constyp_t constyp, const texpr1::builder &t, const scalar &modulo)
 Creates a new constraint from an expression tree and a modulo scalar (both copied). More...
 
 tcons1 (const tcons1 &x)
 (Deep) copy of a constraint. More...
 
 tcons1 (const tcons1 &x, const environment &e)
 Makes a (deep) copy of x and extends its environment. More...
 
 tcons1 (const environment &e, unsat x)
 Makes an unsatisfiable constraint (-1>=0). More...
 
 tcons1 (const lincons1 &x)
 Makes a constraint from a linear constraint (copying coefficients). More...
 
Destructor
 ~tcons1 ()
 Frees the constraint, including the embedded expression tree and optional modulo scalar. More...
 
Assignments
tcons1operator= (const tcons1 &x)
 (Deep) copy. More...
 
tcons1operator= (unsat x)
 Assigns an unsatisfiable constraint to *this (-1>=0). More...
 
tcons1operator= (const lincons1 &x)
 Makes *this equal to the linear constraint x (coefficients are copied), deleting the previous value of *this. More...
 
void set_modulo (const scalar &c)
 Sets the extra scalar modulo to c (copied). More...
 
void set_texpr (const texpr1::builder &c)
 Sets the underlying expression tree to c (copied). More...
 
Dimension operations
void extend_environment (const environment &e)
 Extends the environment of the expression. More...
 
Accesses
environment get_environment () const
 Returns the environment of the expression (with incremented reference count). More...
 
const tcons0get_tcons0 () const
 Returns a reference to the underlying tcons0. More...
 
tcons0get_tcons0 ()
 Returns a (modifiable) reference to the underlying tcons0. More...
 
ap_constyp_t & get_constyp ()
 Returns a (modifiable) reference to the constraint type. More...
 
const ap_constyp_t & get_constyp () const
 Returns a reference to the constraint type. More...
 
bool has_modulo () const
 Returns whether the constraint has a valid extra scalar (used in modulo constraints). More...
 
bool has_texpr () const
 Whether the constraint contains a valid expression tree. More...
 
scalarget_modulo ()
 Returns a (modifiable) reference to the extra scalar. More...
 
const scalarget_modulo () const
 Returns a reference to the extra scalar. More...
 
texpr1::iterator get_texpr ()
 Returns an iterator to the root of the underlying expression tree. More...
 
texpr1::const_iterator get_texpr () const
 Returns a const_iterator to the root of the underlying expression tree. More...
 
Tests
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
const ap_tcons1_t * get_ap_tcons1_t () const
 Returns a pointer to the internal APRON object stored in *this. More...
 
ap_tcons1_t * get_ap_tcons1_t ()
 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

 tcons1 (ap_tcons1_t l)
 Internal use only. Performs a shallow copy and takes ownership of the contents. More...
 

Protected Attributes

ap_tcons1_t l
 Structure managed by APRON. More...
 

Friends

'Intelligent' constructors
tcons1 operator>= (const texpr1::builder &a, const texpr1::builder &b)
 Makes a constraint a-b >= 0. More...
 
tcons1 operator<= (const texpr1::builder &a, const texpr1::builder &b)
 Makes a constraint b-a >= 0. More...
 
tcons1 operator> (const texpr1::builder &a, const texpr1::builder &b)
 Makes a constraint a-b > 0. More...
 
tcons1 operator< (const texpr1::builder &a, const texpr1::builder &b)
 Makes a constraint b-a > 0. More...
 
tcons1 operator== (const texpr1::builder &a, const texpr1::builder &b)
 Makes a constraint a-b == 0. More...
 
tcons1 operator!= (const texpr1::builder &a, const texpr1::builder &b)
 Makes a constraint a-b != 0. More...
 

Printing

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

Detailed Description

Level 1 arbitrary constraint (ap_tcons1_t wrapper).

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

Constructor & Destructor Documentation

◆ tcons1() [1/8]

tcons1::tcons1 ( ap_tcons1_t  l)
inlineprotected

Internal use only. Performs a shallow copy and takes ownership of the contents.

◆ tcons1() [2/8]

apron::tcons1::tcons1 ( const environment env,
ap_constyp_t  constyp = AP_CONS_SUPEQ 
)
inline

Creates an empty constraint.

Neither the expression tree nor the extra scalar are not created (has_texpr and has_modulo both return false).

  • constyp can be AP_CONS_EQ, AP_CONS_SUPEQ, AP_CONS_SUP, or AP_CONS_DISEQ (but not AP_CONS_EQMOD).

◆ tcons1() [3/8]

tcons1::tcons1 ( ap_constyp_t  constyp,
const texpr1::builder t 
)
inline

Creates a new (non-modulo) constraint from an expression tree (copied).

The extra scalar is not created (has_modulo returns false).

  • constyp can be AP_CONS_EQ, AP_CONS_SUPEQ, AP_CONS_SUP, or AP_CONS_DISEQ (but not AP_CONS_EQMOD).

◆ tcons1() [4/8]

tcons1::tcons1 ( ap_constyp_t  constyp,
const texpr1::builder t,
const scalar modulo 
)
inline

Creates a new constraint from an expression tree and a modulo scalar (both copied).

  • constyp can be AP_CONS_EQ, AP_CONS_SUPEQ, AP_CONS_SUP, AP_CONS_EQMOD, or AP_CONS_DISEQ.

◆ tcons1() [5/8]

tcons1::tcons1 ( const tcons1 x)
inline

(Deep) copy of a constraint.

◆ tcons1() [6/8]

tcons1::tcons1 ( const tcons1 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.

◆ tcons1() [7/8]

tcons1::tcons1 ( const environment e,
unsat  x 
)
inline

Makes an unsatisfiable constraint (-1>=0).

◆ tcons1() [8/8]

tcons1::tcons1 ( const lincons1 x)
inline

Makes a constraint from a linear constraint (copying coefficients).

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

◆ ~tcons1()

tcons1::~tcons1 ( )
inline

Frees the constraint, including the embedded expression tree and optional modulo scalar.

Member Function Documentation

◆ extend_environment()

void tcons1::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_tcons1_t() [1/2]

const ap_tcons1_t * tcons1::get_ap_tcons1_t ( ) const
inline

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

◆ get_ap_tcons1_t() [2/2]

ap_tcons1_t * tcons1::get_ap_tcons1_t ( )
inline

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

◆ get_constyp() [1/2]

ap_constyp_t & tcons1::get_constyp ( )
inline

Returns a (modifiable) reference to the constraint type.

Returns
either AP_CONS_EQ, AP_CONS_SUPEQ, AP_CONS_SUP, AP_CONS_EQMOD, or AP_CONS_DISEQ.

◆ get_constyp() [2/2]

const ap_constyp_t & tcons1::get_constyp ( ) const
inline

Returns a reference to the constraint type.

Returns
either AP_CONS_EQ, AP_CONS_SUPEQ, AP_CONS_SUP, AP_CONS_EQMOD, or AP_CONS_DISEQ.

◆ get_environment()

environment tcons1::get_environment ( ) const
inline

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

◆ get_modulo() [1/2]

scalar & tcons1::get_modulo ( )
inline

Returns a (modifiable) reference to the extra scalar.

Exceptions
std::invalid_argumentif no valid extra scalar has been defined.

◆ get_modulo() [2/2]

const scalar & tcons1::get_modulo ( ) const
inline

Returns a reference to the extra scalar.

Exceptions
std::invalid_argumentif no valid extra scalar has been defined.

◆ get_tcons0() [1/2]

const tcons0 & tcons1::get_tcons0 ( ) const
inline

Returns a reference to the underlying tcons0.

◆ get_tcons0() [2/2]

tcons0 & tcons1::get_tcons0 ( )
inline

Returns a (modifiable) reference to the underlying tcons0.

◆ get_texpr() [1/2]

texpr1::iterator tcons1::get_texpr ( )
inline

Returns an iterator to the root of the underlying expression tree.

Exceptions
std::invalid_argumentif no valid expression tree has been defined.

◆ get_texpr() [2/2]

texpr1::const_iterator tcons1::get_texpr ( ) const
inline

Returns a const_iterator to the root of the underlying expression tree.

Exceptions
std::invalid_argumentif no valid expression tree has been defined.

◆ has_modulo()

bool tcons1::has_modulo ( ) const
inline

Returns whether the constraint has a valid extra scalar (used in modulo constraints).

◆ has_texpr()

bool tcons1::has_texpr ( ) const
inline

Whether the constraint contains a valid expression tree.

◆ is_interval_cst()

bool tcons1::is_interval_cst ( ) const
inline

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

Exceptions
std::invalid_argumentif no valid expression tree has been defined.

◆ is_interval_linear()

bool tcons1::is_interval_linear ( ) const
inline

Whether the expression is linear and there is no rounding.

Exceptions
std::invalid_argumentif no valid expression tree has been defined.

◆ is_interval_polyfrac()

bool tcons1::is_interval_polyfrac ( ) const
inline

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

Exceptions
std::invalid_argumentif no valid expression tree has been defined.

◆ is_interval_polynomial()

bool tcons1::is_interval_polynomial ( ) const
inline

Whether the expression is polynomial and there is no rounding.

Exceptions
std::invalid_argumentif no valid expression tree has been defined.

◆ is_scalar()

bool tcons1::is_scalar ( ) const
inline

Whether all occurring constants are scalar.

Exceptions
std::invalid_argumentif no valid expression tree has been defined.

◆ operator=() [1/3]

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

(Deep) copy.

◆ operator=() [2/3]

tcons1 & tcons1::operator= ( unsat  x)
inline

Assigns an unsatisfiable constraint to *this (-1>=0).

◆ operator=() [3/3]

tcons1 & tcons1::operator= ( const lincons1 x)
inline

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

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

◆ print()

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

Prints to a C stream.

◆ set_modulo()

void tcons1::set_modulo ( const scalar c)
inline

Sets the extra scalar modulo to c (copied).

Does not fail as get_modulo can: if the constraint was created without an extra scalar, it is created.

◆ set_texpr()

void tcons1::set_texpr ( const texpr1::builder c)
inline

Sets the underlying expression tree to c (copied).

Does not fail as get_texpr can: if the constraint was created without an underlying expression, it is created.

Friends And Related Function Documentation

◆ operator!=

tcons1 operator!= ( const texpr1::builder a,
const texpr1::builder b 
)
friend

Makes a constraint a-b != 0.

◆ operator<

tcons1 operator< ( const texpr1::builder a,
const texpr1::builder b 
)
friend

Makes a constraint b-a > 0.

◆ operator<<

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

Printing.

Exceptions
std::invalid_argumentif the underlying expression is missing, or the extra scalar is missing (for modulo).

◆ operator<=

tcons1 operator<= ( const texpr1::builder a,
const texpr1::builder b 
)
friend

Makes a constraint b-a >= 0.

◆ operator==

tcons1 operator== ( const texpr1::builder a,
const texpr1::builder b 
)
friend

Makes a constraint a-b == 0.

◆ operator>

tcons1 operator> ( const texpr1::builder a,
const texpr1::builder b 
)
friend

Makes a constraint a-b > 0.

◆ operator>=

tcons1 operator>= ( const texpr1::builder a,
const texpr1::builder b 
)
friend

Makes a constraint a-b >= 0.

Member Data Documentation

◆ l

ap_tcons1_t apron::tcons1::l
protected

Structure managed by APRON.


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