ibex::Env Class Reference

Environment for symbols, expressions and constraints. More...

#include <IbexEnv.h>

Inheritance diagram for ibex::Env:

ibex::SharedObject

List of all members.

Public Member Functions

 ~Env ()
int nb_keys () const
pair< int, Dimsymbol_info (const char full_name[]) const
pair< int, Dimsymbol_info (const char *base_name, int index1, int index2, int index3) const
int symbol_key (const char *full_name) const
Dim symbol_dim (const char *full_name) const
const char * symbol_name (int key) const
const Symbolsymbol (int key) const
const Symboladd_symbol (const char *base_name, const Dim &dim)
const Symbolsymbol_expr (const char *base_name) const
const ExtendedSymbolext_symbol_expr (const char *full_name) const
bool used (const char *base_name) const
const Symboladd_symbol (const char *base_name, int length1=0, int length2=0, int length3=0)
const Symboladd_anonymous_symbol (int length1=0, int length2=0, int length3=0)
const Exprexpression (int i)
void add_expression (const Expr &expr)
int nb_expressions ()
int add_ctr (const Constraint &c, const char *name=NULL)
int nb_constraints () const
const Constraintconstraint (int num) const
const Constraintconstraint (const char *ctr_name) const
void add_function (const Function &func)
const Functionfunction (const char *func_name) const

Friends

std::ostream & operator<< (std::ostream &, const Env &)


Detailed Description

Environment for symbols, expressions and constraints.

Handles the symbolic part of constraint processing.

For the moment, this class is only used as a container for symbols, expressions and constraints. All the expressions of the same context (i.e., whose variable symbols have to be bound to the same entity) must be stored in the same environment. An environment therefore also defines the context of different constraints/contractors. Any symbolic handling such as creation, copy (and possibly factorization, development, etc. in the future) has to be performed via the environment.

Author:
Gilles Chabert
Date:
December 2007

Constructor & Destructor Documentation

ibex::Env::~Env (  ) 

Delete this instance.


Member Function Documentation

int ibex::Env::nb_keys (  )  const [inline]

Return the number of symbol keys in the environment.

pair< int, struct Dim > ibex::Env::symbol_info ( const char  full_name[]  )  const

Return the information (key and dimension) of a symbol, from its full name.

pair< int, struct Dim > ibex::Env::symbol_info ( const char *  base_name,
int  index1,
int  index2,
int  index3 
) const

Return the information (key and dimension) of a symbol, from its base name and indexes.

int ibex::Env::symbol_key ( const char *  full_name  )  const [inline]

Returnthe key associated to a symbol.

Dim ibex::Env::symbol_dim ( const char *  full_name  )  const [inline]

Return the dimension associated to a symbol.

const char * ibex::Env::symbol_name ( int  key  )  const

Return the name associated to a symbol key.

Warning:
the worst-case complexity is *not* O(1) but O(nb_keys()). This might be fixed in future versions

const Symbol & ibex::Env::symbol ( int  key  )  const

Return the symbol whose key is key.

Warning:
see the comment about complexity in symbol_name(int) const.

const Symbol & ibex::Env::add_symbol ( const char *  base_name,
const Dim dim 
)

Insert a new symbol into the environment.

Parameters:
base_name The symbol name, e.g., "x".
dim The dimension, e.g., Dim(0,2,3) which means that "x" is a 2x3 array.
Returns:
the first key corresponding to this symbol. In the case of a 2x3 array, there will be 6 consecutive keys allocated for the symbol "x". The first key corresponds to the symbol "x[1][1]".

const Symbol& ibex::Env::symbol_expr ( const char *  base_name  )  const [inline]

Get the symbol expression from its base name.

Remarks:
A base name is a single symbol, such as "x". It cannot be "x[1]".
Returns:
the symbol expression.

const ExtendedSymbol & ibex::Env::ext_symbol_expr ( const char *  full_name  )  const

Get the extended symbol expression from its full name.

bool ibex::Env::used ( const char *  base_name  )  const [inline]

Return true if the symbol base_name exists in the environment.

Remarks:
A base name is a single symbol, such as "x". It cannot be "x[1]".

const Symbol & ibex::Env::add_symbol ( const char *  base_name,
int  length1 = 0,
int  length2 = 0,
int  length3 = 0 
)

Insert a new symbol into the environment. This function is typically used by ibex::CSP::CSP(const char*). It can also be used when equations are not defined explicitely but via contractors (in this case, symbols must be inserted manually).

Parameters:
base_name - the symbol base name (e.g., "x").
length1 (optional) - if set, this symbol is a vector of dimension length1.
length2 (optional) - if set, this symbol is a matrix of length1 rows and length2 columns. If x is such a symbol, x[i] designates the transpose of the ith row (i.e., a column vector) and x[i][j] designates the entry (i,j).
length3 (optional) - if set this symbol is an array of length1 matrices of dimension length2 x length3. If x is such a symbol, x[k] designates a matrix, x[k][i] the transpose of the ith row of the kth matrix (i.e., a column vector) and x[k][i][j] an entry.
Returns:
the first key corresponding to this symbol. (see add_symbol(const char*, const Dim&)).

const Symbol & ibex::Env::add_anonymous_symbol ( int  length1 = 0,
int  length2 = 0,
int  length3 = 0 
)

Insert a new, automaticaly generated, symbol. This function is useful, e.g., when a contractor needs to create an entity for its own purpose. In this case, since the symbol associated to the entity is not used anywhere else, its actual name does not matter (provided that it is decided to handle this symbol only by its key in the contractor).

const Expr& ibex::Env::expression ( int  i  )  [inline]

Return the ith expression.

void ibex::Env::add_expression ( const Expr expr  )  [inline]

Add a new expression.

int ibex::Env::nb_expressions (  )  [inline]

Return the total number of expressions.

int ibex::Env::add_ctr ( const Constraint c,
const char *  name = NULL 
)

Add a new constraint into the environment.

Returns:
the number of the newly inserted constraint.

int ibex::Env::nb_constraints (  )  const [inline]

Return the number of constraint expressions in the environment.

const Constraint& ibex::Env::constraint ( int  num  )  const [inline]

Return the expression of the num th constraint.

const Constraint& ibex::Env::constraint ( const char *  ctr_name  )  const [inline]

Return the expression of the constraint named ctr_name.

void ibex::Env::add_function ( const Function func  ) 

Add a new function into the environment. The memory will be disallocated by the environment itself.

const Function& ibex::Env::function ( const char *  func_name  )  const [inline]

Return the function whose name is func_name.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Env env 
) [friend]

Stream out the content of the environment (for debug purposes).


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

Generated on Sun Jun 27 15:52:00 2010 for IBEX by  doxygen 1.5.5