APRONXX 0.9.15
apron::environment Class Reference

Level 1 environment (ap_environment_t wrapper). More...

#include <apxx_environment.hh>

Inherits apron::use_malloc.

Public Member Functions

Constructors
 environment ()
 Creates a new empty environment.
 
 environment (const std::vector< var > &intdim, const std::vector< var > &realdim)
 Creates a new environment with given integer and real variable names (copied).
 
 environment (const var *intdim, size_t intdim_size, const var *realdim, size_t realdim_size)
 Creates a new environment with given integer and real variable names (copied).
 
 environment (const environment &x)
 Creates a copy (i.e., increments the reference counter).
 
Destructor
 ~environment ()
 Decrements the reference counter and, if null, actually frees the environment.
 
Assignment
const environmentoperator= (const environment &x)
 Assignment (reference counter manipulation).
 
Accesses
size_t intdim () const
 Returns the number of integer dimensions in the environment.
 
size_t realdim () const
 Returns the number of real dimensions in the environment.
 
bool contains (const var &x) const
 Whether the environment contains the variable name x.
 
ap_dim_t operator[] (const var &x) const
 Returns the dimension associated with the variable name.
 
const varoperator[] (ap_dim_t d) const
 Returns the variable name at a given dimension (no bound-check).
 
ap_dim_t get_dim (const var &x) const
 Returns the dimension associated with a variable name.
 
const varget_var (ap_dim_t d) const
 Returns the variable name at a given dimension (bound-checked).
 
std::vector< varget_vars () const
 Returns (a copy of) the full map from dimensions to variable names.
 
C API compatibility
const ap_environment_t * get_ap_environment_t () const
 Returns a pointer to the internal APRON object pointed by *this.
 
ap_environment_t * get_ap_environment_t ()
 Returns a pointer to the internal APRON object pointed by *this.
 
- 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

 environment (ap_environment_t *x)
 Used internally only. Wraps the APRON object in an environment object (no copy, no change in reference counter).
 

Protected Attributes

ap_environment_t * e
 

Operations

environment add (const std::vector< var > &intdim, const std::vector< var > &realdim) const
 Returns a copy of the environment with some integer and/or real variable names added.
 
environment add (const var *intdim, size_t intdim_size, const var *realdim, size_t realdim_size) const
 Returns a copy of the environment with intdim_size integer and realdim_size real variable names added.
 
environment add (const std::vector< var > &intdim, const std::vector< var > &realdim, dimperm &perm) const
 Returns a copy of the environment with some integer and/or real variable names added.
 
environment add (const var *intdim, size_t intdim_size, const var *realdim, size_t realdim_size, dimperm &perm) const
 Returns a copy of the environment with intdim_size integer and realdim_size real variable names added.
 
environment remove (const std::vector< var > &dims) const
 Returns a copy of the environment with some variable names removed.
 
environment remove (const var *dims, size_t dims_size) const
 Returns a copy of the environment with dims_size variable names removed.
 
environment rename (const std::vector< std::pair< var, var > > &dims) const
 Returns a copy of the environment with some variable names substituted.
 
environment rename (const var *before, const var *after, size_t dims_size) const
 Returns a copy of the environment with dims_size variable names substituted.
 
environment rename (const std::vector< std::pair< var, var > > &dims, dimperm &perm) const
 Returns a copy of the environment with some variable names substituted.
 
environment rename (const var *before, const var *after, size_t dims_size, dimperm &perm) const
 Returns a copy of the environment with dims_size variable names substituted.
 

Printing

void print (FILE *stream=stdout) const
 Prints to a C stream.
 

Detailed Description

Level 1 environment (ap_environment_t wrapper).

An environment associates dimensions to integer and real variable names (var). It stores a number intdim of integer dimensions, a number realdim of real dimensions, and an array of size intdim+realdim variable names indexed by dimensions. Dimensions 0 to intdim-1 are associated to integer variables while dimensions intdim to intdim+realdim-1 are associated to real variables. Variables in both slices [0;intdim-1] and [intdim;intdim+realdim-1] are always sorted in strictly increasing order. (Recall that variables have the following user-specified functions: copy, deallocation, comparison, conversion to string.) This invariant is automatically enforced by the library by performing dimension permutations after variable name addition, deletion, or renaming. Thus, such an operation can change the dimension associated to existing variable names.

Environments are reference-counted and the API is fully functional (i.e., functions do not change *this but return a new object instead).

Constructor & Destructor Documentation

◆ environment() [1/5]

apron::environment::environment ( ap_environment_t * x)
inlineprotected

Used internally only. Wraps the APRON object in an environment object (no copy, no change in reference counter).

◆ environment() [2/5]

environment::environment ( )
inline

Creates a new empty environment.

◆ environment() [3/5]

environment::environment ( const std::vector< var > & intdim,
const std::vector< var > & realdim )
inline

Creates a new environment with given integer and real variable names (copied).

Exceptions
std::invalid_argumentif variable names are not distinct.

◆ environment() [4/5]

environment::environment ( const var * intdim,
size_t intdim_size,
const var * realdim,
size_t realdim_size )
inline

Creates a new environment with given integer and real variable names (copied).

Exceptions
std::invalid_argumentif variable names are not distinct.

◆ environment() [5/5]

environment::environment ( const environment & x)
inline

Creates a copy (i.e., increments the reference counter).

◆ ~environment()

environment::~environment ( )
inline

Decrements the reference counter and, if null, actually frees the environment.

Member Function Documentation

◆ add() [1/4]

environment environment::add ( const std::vector< var > & intdim,
const std::vector< var > & realdim ) const
inline

Returns a copy of the environment with some integer and/or real variable names added.

Exceptions
std::invalid_argumentif the resulting environment has duplicate variable names.

◆ add() [2/4]

environment environment::add ( const std::vector< var > & intdim,
const std::vector< var > & realdim,
dimperm & perm ) const
inline

Returns a copy of the environment with some integer and/or real variable names added.

Sets perm to the dimension permutation that has been performed after appending variable names at the end of integer (resp. real) dimensions to get them sorted again.

Exceptions
std::invalid_argumentif the resulting environment has duplicate variable names.

◆ add() [3/4]

environment environment::add ( const var * intdim,
size_t intdim_size,
const var * realdim,
size_t realdim_size ) const
inline

Returns a copy of the environment with intdim_size integer and realdim_size real variable names added.

Exceptions
std::invalid_argumentif the resulting environment has duplicate variable names.

◆ add() [4/4]

environment environment::add ( const var * intdim,
size_t intdim_size,
const var * realdim,
size_t realdim_size,
dimperm & perm ) const
inline

Returns a copy of the environment with intdim_size integer and realdim_size real variable names added.

Sets perm to the dimension permutation that has been performed after appending variable names at the end of integer (resp. real) dimensions to get them sorted again.

Exceptions
std::invalid_argumentif the resulting environment has duplicate variable names.

◆ contains()

bool environment::contains ( const var & x) const
inline

Whether the environment contains the variable name x.

◆ get_ap_environment_t() [1/2]

ap_environment_t * environment::get_ap_environment_t ( )
inline

Returns a pointer to the internal APRON object pointed by *this.

◆ get_ap_environment_t() [2/2]

const ap_environment_t * environment::get_ap_environment_t ( ) const
inline

Returns a pointer to the internal APRON object pointed by *this.

◆ get_dim()

ap_dim_t environment::get_dim ( const var & x) const
inline

Returns the dimension associated with a variable name.

Exceptions
std::invalid_argumentif there is no such variable name in the environment.

◆ get_var()

const var & environment::get_var ( ap_dim_t d) const
inline

Returns the variable name at a given dimension (bound-checked).

Exceptions
std::out_of_rangeif the dimension is larger than the environment size.

◆ get_vars()

std::vector< var > environment::get_vars ( ) const
inline

Returns (a copy of) the full map from dimensions to variable names.

◆ intdim()

size_t environment::intdim ( ) const
inline

Returns the number of integer dimensions in the environment.

◆ operator=()

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

Assignment (reference counter manipulation).

◆ operator[]() [1/2]

const var & environment::operator[] ( ap_dim_t d) const
inline

Returns the variable name at a given dimension (no bound-check).

◆ operator[]() [2/2]

ap_dim_t environment::operator[] ( const var & x) const
inline

Returns the dimension associated with the variable name.

Exceptions
std::invalid_argumentif there is no such variable name in the environment.

◆ print()

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

Prints to a C stream.

◆ realdim()

size_t environment::realdim ( ) const
inline

Returns the number of real dimensions in the environment.

◆ remove() [1/2]

environment environment::remove ( const std::vector< var > & dims) const
inline

Returns a copy of the environment with some variable names removed.

Exceptions
std::invalid_argumentif some variable name does not exist.

◆ remove() [2/2]

environment environment::remove ( const var * dims,
size_t dims_size ) const
inline

Returns a copy of the environment with dims_size variable names removed.

Exceptions
std::invalid_argumentif some variable name does not exist.

◆ rename() [1/4]

environment environment::rename ( const std::vector< std::pair< var, var > > & dims) const
inline

Returns a copy of the environment with some variable names substituted.

dims[i].first is replaced with dims[i].second.

Exceptions
std::invalid_argumentif some variable name does not exist.

◆ rename() [2/4]

environment environment::rename ( const std::vector< std::pair< var, var > > & dims,
dimperm & perm ) const
inline

Returns a copy of the environment with some variable names substituted.

dims[i].first is replaced with dims[i].second. Sets perm to the dimension permutation that has been performed after renaming the variable names in-place to get them sorted again.

Exceptions
std::invalid_argumentif some variable name does not exist.

◆ rename() [3/4]

environment environment::rename ( const var * before,
const var * after,
size_t dims_size ) const
inline

Returns a copy of the environment with dims_size variable names substituted.

before[i] is replaced with after[i]. Both array should contain dims_size elements.

Exceptions
std::invalid_argumentif some variable name does not exist.

◆ rename() [4/4]

environment environment::rename ( const var * before,
const var * after,
size_t dims_size,
dimperm & perm ) const
inline

Returns a copy of the environment with dims_size variable names substituted.

before[i] is replaced with after[i]. Both array should contain dims_size elements. Sets perm to the dimension permutation that has been performed after renaming the variable names in-place to get them sorted again.

Exceptions
std::invalid_argumentif some variable name does not exist.

Member Data Documentation

◆ e

ap_environment_t* apron::environment::e
protected

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