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

Level 1 linear constraint (ap_lincons1_t wrapper). More...

#include <apxx_lincons1.hh>

Inherits apron::use_malloc.

Public Member Functions

Constructors
 lincons1 (const environment &e, const lincons0 &x)
 Creates a new constraint from a lincons0 (copied) and an environment (reference count incremented) associating names to dimensions in lincons0. More...
 
 lincons1 (const environment &e, ap_constyp_t constyp=AP_CONS_SUPEQ)
 Creates a new (non-modulo) constraint from an empty linear expression. More...
 
 lincons1 (ap_constyp_t constyp, const linexpr1 &lin)
 Creates a new (non-modulo) constraint from a linear expression (copied). More...
 
 lincons1 (ap_constyp_t constyp, const linexpr1 &lin, const scalar &modulo)
 Creates a new constraint from a linear expression and a modulo scalar (both copied). More...
 
 lincons1 (const environment &e, unsat x)
 Makes an unsatisfiable constraint (-1>=0). More...
 
 lincons1 (const lincons1 &x)
 (Deep) copy of a constraint. More...
 
 lincons1 (const lincons1 &x, const environment &e)
 Makes a (deep) copy of x and extends its environment. More...
 
Destructor
 ~lincons1 ()
 Frees all space for the expression and coefficients, and decrements the reference count of the environment. More...
 
Assignment
lincons1operator= (const lincons1 &x)
 Makes a (deep) copy. More...
 
lincons1operator= (unsat x)
 Assigns an unsatisfiable constraint to *this (-1>=0). More...
 
void set_modulo (const scalar &c)
 Sets the auxiliary scalar modulo to c (copied). More...
 
void set_linexpr (const linexpr1 &c)
 Sets the underlying linear expression to c (copied). More...
 
Dimension operations
void extend_environment (const environment &e)
 Extends the environment of the expression. More...
 
Accesses, size
environment get_environment () const
 Returns the environment of the constraint (with incremented reference count). More...
 
const lincons0get_lincons0 () const
 Returns a reference to the underlying lincons0. More...
 
lincons0get_lincons0 ()
 Returns a (modifiable) reference to the underlying lincons0. More...
 
size_t size () const
 Returns the size of the underlying linear expression. 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
 Whether the constraint has a valid auxiliary scalar (used in modulo constraints). More...
 
bool has_linexpr () const
 Whether the constraint has a valid linear expression. More...
 
scalarget_modulo ()
 Returns a (modifiable) reference to the auxiliary scalar. More...
 
const scalarget_modulo () const
 Returns a reference to the auxiliary scalar. More...
 
linexpr1 get_linexpr () const
 Returns a copy of the underlying linear expression. More...
 
coeffget_cst ()
 Returns a (modifiable) reference to the constant coefficient. More...
 
const coeffget_cst () const
 Returns a reference to the constant coefficient. More...
 
coeffoperator[] (const var &v)
 Returns a (modifiable) reference to the coefficient corresponding to the given variable name. More...
 
const coeffoperator[] (const var &v) const
 Returns a reference to the coefficient corresponding to the given variable name. More...
 
Tests
bool is_unsat () const
 Whether the constraint is unsatisfiable. More...
 
bool is_linear () const
 Whether the underlying linear expression has only scalar coefficients. More...
 
bool is_quasilinear () const
 Whether the underlying linear expression has only scalar coefficients, except maybe for the constant one. More...
 
C API compatibility
const ap_lincons1_t * get_ap_lincons1_t () const
 Returns a pointer to the internal APRON object stored in *this. More...
 
ap_lincons1_t * get_ap_lincons1_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

 lincons1 (ap_lincons1_t p)
 Internal use only. Shallow copy (no copy of lincons0 or environment). More...
 

Protected Attributes

ap_lincons1_t l
 Structure managed by APRON. More...
 

Printing

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

Detailed Description

Level 1 linear constraint (ap_lincons1_t wrapper).

Level 1 version of linear constraints with scalar or interval coefficients (coeff). Terms are indexed using variable names (var) instead of dimensions (ap_dim_t). Internally, a lincons1 wraps together a lincons0 (memory managed) and an environment (holding a reference count).

Constructor & Destructor Documentation

◆ lincons1() [1/8]

lincons1::lincons1 ( ap_lincons1_t  p)
inlineprotected

Internal use only. Shallow copy (no copy of lincons0 or environment).

◆ lincons1() [2/8]

lincons1::lincons1 ( const environment e,
const lincons0 x 
)
inline

Creates a new constraint from a lincons0 (copied) and an environment (reference count incremented) associating names to dimensions in lincons0.

◆ lincons1() [3/8]

apron::lincons1::lincons1 ( const environment e,
ap_constyp_t  constyp = AP_CONS_SUPEQ 
)
inline

Creates a new (non-modulo) constraint from an empty linear expression.

The auxiliary scalar is not created (has_modulo returns false). The linear expression is created sparse and empty (has_linexpr returns true).

  • e associates a variable name to each dimension (reference counter incremented).
  • constyp can be AP_CONS_EQ, AP_CONS_SUPEQ, AP_CONS_SUP, or AP_CONS_DISEQ (but not AP_CONS_EQMOD).

◆ lincons1() [4/8]

lincons1::lincons1 ( ap_constyp_t  constyp,
const linexpr1 lin 
)
inline

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

The auxiliary 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).

◆ lincons1() [5/8]

lincons1::lincons1 ( ap_constyp_t  constyp,
const linexpr1 lin,
const scalar modulo 
)
inline

Creates a new constraint from a linear expression 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.

◆ lincons1() [6/8]

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

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

◆ lincons1() [7/8]

lincons1::lincons1 ( const lincons1 x)
inline

(Deep) copy of a constraint.

◆ lincons1() [8/8]

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

◆ ~lincons1()

lincons1::~lincons1 ( )
inline

Frees all space for the expression and coefficients, and decrements the reference count of the environment.

Member Function Documentation

◆ extend_environment()

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

const ap_lincons1_t * lincons1::get_ap_lincons1_t ( ) const
inline

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

◆ get_ap_lincons1_t() [2/2]

ap_lincons1_t * lincons1::get_ap_lincons1_t ( )
inline

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

◆ get_constyp() [1/2]

ap_constyp_t & lincons1::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 & lincons1::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_cst() [1/2]

coeff & lincons1::get_cst ( )
inline

Returns a (modifiable) reference to the constant coefficient.

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

◆ get_cst() [2/2]

const coeff & lincons1::get_cst ( ) const
inline

Returns a reference to the constant coefficient.

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

◆ get_environment()

environment lincons1::get_environment ( ) const
inline

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

◆ get_lincons0() [1/2]

const lincons0 & lincons1::get_lincons0 ( ) const
inline

Returns a reference to the underlying lincons0.

◆ get_lincons0() [2/2]

lincons0 & lincons1::get_lincons0 ( )
inline

Returns a (modifiable) reference to the underlying lincons0.

◆ get_linexpr()

linexpr1 lincons1::get_linexpr ( ) const
inline

Returns a copy of the underlying linear expression.

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

◆ get_modulo() [1/2]

scalar & lincons1::get_modulo ( )
inline

Returns a (modifiable) reference to the auxiliary scalar.

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

◆ get_modulo() [2/2]

const scalar & lincons1::get_modulo ( ) const
inline

Returns a reference to the auxiliary scalar.

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

◆ has_linexpr()

bool lincons1::has_linexpr ( ) const
inline

Whether the constraint has a valid linear expression.

Note
The only way the linear expression may be invalid is when accessing fields of uninitialised (or enlarged) lincons1_array.

◆ has_modulo()

bool lincons1::has_modulo ( ) const
inline

Whether the constraint has a valid auxiliary scalar (used in modulo constraints).

◆ is_linear()

bool lincons1::is_linear ( ) const
inline

Whether the underlying linear expression has only scalar coefficients.

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

◆ is_quasilinear()

bool lincons1::is_quasilinear ( ) const
inline

Whether the underlying linear expression has only scalar coefficients, except maybe for the constant one.

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

◆ is_unsat()

bool lincons1::is_unsat ( ) const
inline

Whether the constraint is unsatisfiable.

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

◆ operator=() [1/2]

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

Makes a (deep) copy.

◆ operator=() [2/2]

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

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

◆ operator[]() [1/2]

coeff & apron::lincons1::operator[] ( const var v)
inline

Returns a (modifiable) reference to the coefficient corresponding to the given variable name.

Exceptions
std::invalid_argumentif the variable name is not present in the environment.
std::invalid_argumentif no valid linear expression has been defined.

◆ operator[]() [2/2]

const coeff & apron::lincons1::operator[] ( const var v) const
inline

Returns a reference to the coefficient corresponding to the given variable name.

Exceptions
std::invalid_argumentif the variable name is not present in the environment.
std::invalid_argumentif no valid linear expression has been defined.

◆ print()

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

Prints to a C stream.

◆ set_linexpr()

void lincons1::set_linexpr ( const linexpr1 c)
inline

Sets the underlying linear expression to c (copied).

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

Warning
assumes that c and *this have equal environments (unchecked).

◆ set_modulo()

void lincons1::set_modulo ( const scalar c)
inline

Sets the auxiliary scalar modulo to c (copied).

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

◆ size()

size_t lincons1::size ( ) const
inline

Returns the size of the underlying linear expression.

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

Friends And Related Function Documentation

◆ operator<<

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

Printing.

Member Data Documentation

◆ l

ap_lincons1_t apron::lincons1::l
protected

Structure managed by APRON.


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