Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members | Related Pages

# Parma_Polyhedra_Library::Variable Class Reference

A dimension of the space. More...

List of all members.

## Public Types
typedef void | output_function_type (std::ostream &s, const Variable &v)
| Type of output functions.
## Public Member Functions
| Variable (dimension_type i)
| Builds the variable corresponding to the Cartesian axis of index `i`.
dimension_type | id () const
| Returns the index of the Cartesian axis associated to the variable.
## Static Public Member Functions
void | set_output_function (output_function_type *p)
| Sets the output function to be used for printing Variable objects.
output_function_type * | get_output_function ()
| Returns the pointer to the current output function.
## Related Functions
(Note that these are not member functions.)
std::ostream & | operator<< (std::ostream &s, const Variable &v)
| Output operator.
bool | less (Variable v, Variable w)
| Defines a total ordering on variables.

## Detailed Description

A dimension of the space.

An object of the class Variable represents a dimension of the space, that is one of the Cartesian axes. Variables are used as base blocks in order to build more complex linear expressions. Each variable is identified by a non-negative integer, representing the index of the corresponding Cartesian axis (the first axis has index 0).

Note that the ``meaning'' of an object of the class Variable is completely specified by the integer index provided to its constructor: be careful not to be mislead by C++ language variable names. For instance, in the following example the linear expressions `e1` and `e2` are equivalent, since the two variables `x` and `z` denote the same Cartesian axis.

      Variable x(0);
      Variable y(1);
      Variable z(0);
      LinExpression e1 = x + y;
      LinExpression e2 = y + z;