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

Level 1 generator (ap_generator1_t wrapper). More...

#include <apxx_generator1.hh>

Inherits apron::use_malloc.

Public Member Functions

Constructors
 generator1 (const environment &e, const generator0 &x)
 Creates a new generator from a generator0 (copied) and an environment (reference count incremented) associating names to dimensions in generator0. More...
 
 generator1 (const environment &e, ap_gentyp_t gentyp=AP_GEN_RAY)
 Creates a new generator from an empty linear expression. More...
 
 generator1 (ap_gentyp_t gentyp, const linexpr1 &lin)
 Creates a new generator from a linear expression (copied). More...
 
 generator1 (const generator1 &x)
 (Deep) copy of a generator. More...
 
 generator1 (const generator1 &x, const environment &e)
 Makes a (deep) copy of x and extends its environment. More...
 
Destructor
 ~generator1 ()
 Frees all space for the generator, and decrements the reference count of the environment. More...
 
Assignment
generator1operator= (const generator1 &x)
 Makes a (deep) copy. 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 generator. More...
 
Accesses, size
environment get_environment () const
 Returns the environment of the generator (with incremented reference count). More...
 
const generator0get_generator0 () const
 Returns a reference to the underlying generator0. More...
 
generator0get_generator0 ()
 Returns a (modifiable) reference to the underlying generator0. More...
 
size_t size () const
 Returns the size of the underlying linear expression. More...
 
ap_gentyp_t & get_gentyp ()
 Returns a (modifiable) reference to the constraint type. More...
 
const ap_gentyp_t & get_gentyp () const
 Returns a reference to the constraint type. More...
 
bool has_linexpr () const
 Whether the generator has a valid linear expression. 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...
 
C API compatibility
const ap_generator1_t * get_ap_generator1_t () const
 Returns a pointer to the internal APRON object stored in *this. More...
 
ap_generator1_t * get_ap_generator1_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

 generator1 (ap_generator1_t p)
 Internal use only. Shallow copy (no copy of generator0 or environment). More...
 

Protected Attributes

ap_generator1_t l
 Structure managed by APRON. More...
 

Printing

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

Detailed Description

Level 1 generator (ap_generator1_t wrapper).

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

Constructor & Destructor Documentation

◆ generator1() [1/6]

generator1::generator1 ( ap_generator1_t  p)
inlineprotected

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

◆ generator1() [2/6]

generator1::generator1 ( const environment e,
const generator0 x 
)
inline

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

◆ generator1() [3/6]

apron::generator1::generator1 ( const environment e,
ap_gentyp_t  gentyp = AP_GEN_RAY 
)
inline

Creates a new generator from an empty linear expression.

The linear expression is created sparse and empty (has_linexpr returns true).

  • e associates a variable name to each dimension (reference counter incremented).
  • gentyp can be AP_GEN_LINE, AP_GEN_RAY, AP_GEN_VERTEX, AP_GEN_LINEMOD, or AP_GEN_RAYMOD.

◆ generator1() [4/6]

generator1::generator1 ( ap_gentyp_t  gentyp,
const linexpr1 lin 
)
inline

Creates a new generator from a linear expression (copied).

  • e associates a variable name to each dimension (reference counter incremented).
  • gentyp can be AP_GEN_LINE, AP_GEN_RAY, AP_GEN_VERTEX, AP_GEN_LINEMOD, or AP_GEN_RAYMOD.
Warning
lin should have only scalar (non-interval) coefficients (unchecked).

◆ generator1() [5/6]

generator1::generator1 ( const generator1 x)
inline

(Deep) copy of a generator.

◆ generator1() [6/6]

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

◆ ~generator1()

generator1::~generator1 ( )
inline

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

Member Function Documentation

◆ extend_environment()

void generator1::extend_environment ( const environment e)
inline

Extends the environment of the generator.

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

◆ get_ap_generator1_t() [1/2]

const ap_generator1_t * generator1::get_ap_generator1_t ( ) const
inline

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

◆ get_ap_generator1_t() [2/2]

ap_generator1_t * generator1::get_ap_generator1_t ( )
inline

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

◆ get_cst() [1/2]

coeff & generator1::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 & generator1::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 generator1::get_environment ( ) const
inline

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

◆ get_generator0() [1/2]

const generator0 & generator1::get_generator0 ( ) const
inline

Returns a reference to the underlying generator0.

◆ get_generator0() [2/2]

generator0 & generator1::get_generator0 ( )
inline

Returns a (modifiable) reference to the underlying generator0.

◆ get_gentyp() [1/2]

ap_gentyp_t & generator1::get_gentyp ( )
inline

Returns a (modifiable) reference to the constraint type.

Returns
either AP_GEN_LINE, AP_GEN_RAY, AP_GEN_VERTEX, AP_GEN_LINEMOD, or AP_GEN_RAYMOD.

◆ get_gentyp() [2/2]

const ap_gentyp_t & generator1::get_gentyp ( ) const
inline

Returns a reference to the constraint type.

Returns
either AP_GEN_LINE, AP_GEN_RAY, AP_GEN_VERTEX, AP_GEN_LINEMOD, or AP_GEN_RAYMOD.

◆ get_linexpr()

linexpr1 generator1::get_linexpr ( ) const
inline

Returns a copy of the underlying linear expression.

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

◆ has_linexpr()

bool generator1::has_linexpr ( ) const
inline

Whether the generator has a valid linear expression.

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

◆ operator=()

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

Makes a (deep) copy.

◆ operator[]() [1/2]

coeff & apron::generator1::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::generator1::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 generator1::print ( FILE *  stream = stdout) const
inline

Prints to a C stream.

◆ set_linexpr()

void generator1::set_linexpr ( const linexpr1 c)
inline

Sets the underlying linear expression to c (copied).

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

Warning
c should have only scalar (non-interval) coefficients (unchecked).
assumes that c and *this have equal environments (unchecked).

◆ size()

size_t generator1::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 generator1 s 
)
friend

Printing.

Member Data Documentation

◆ l

ap_generator1_t apron::generator1::l
protected

Structure managed by APRON.


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