#include <Variable.defs.hh>
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. | |
dimension_type | space_dimension () const |
Returns the dimension of the vector space enclosing *this . | |
memory_size_type | total_memory_in_bytes () const |
Returns the total size in bytes of the memory occupied by *this . | |
memory_size_type | external_memory_in_bytes () const |
Returns the size in bytes of the memory managed by *this . | |
bool | OK () const |
Checks if all the invariants are satisfied. | |
typedef void | output_function_type (std::ostream &s, const Variable &v) |
Type of output functions. | |
Static Public Member Functions | |
static dimension_type | max_space_dimension () |
Returns the maximum space dimension a Variable can handle. | |
static void | set_output_function (output_function_type *p) |
Sets the output function to be used for printing Variable objects. | |
static output_function_type * | get_output_function () |
Returns the pointer to the current output function. | |
Static Private Member Functions | |
static void | default_output_function (std::ostream &s, const Variable &v) |
The default output function. | |
Private Attributes | |
dimension_type | varid |
The index of the Cartesian axis. | |
Static Private Attributes | |
static output_function_type * | current_output_function = 0 |
Pointer to the current output function. | |
Friends | |
class | Init |
std::ostream & | operator<< (std::ostream &s, const Variable &v) |
Output operator. | |
Related Functions | |
(Note that these are not member functions.) | |
bool | less (Variable v, Variable w) |
Defines a total ordering on variables. | |
Classes | |
struct | Compare |
Binary predicate defining the total ordering on variables. More... |
An object of the class Variable represents a dimension of the space, that is one of the Cartesian axes. Variables are used as basic 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). The space dimension of a variable is the dimension of the vector space made by all the Cartesian axes having an index less than or equal to that of the considered variable; thus, if a variable has index , its space dimension is
.
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); Linear_Expression e1 = x + y; Linear_Expression e2 = y + z;
Definition at line 80 of file Variable.defs.hh.
Parma_Polyhedra_Library::Variable::Variable | ( | dimension_type | i | ) | [inline, explicit] |
Builds the variable corresponding to the Cartesian axis of index i
.
std::length_error | Thrown if the i+1 exceeds Variable::max_space_dimension() . |
Definition at line 37 of file Variable.inlines.hh.
00038 : varid(i < max_space_dimension() 00039 ? i 00040 : (throw std::length_error("PPL::Variable::Variable(i):\n" 00041 "i exceeds the maximum allowed " 00042 "variable identifier."), i)) { 00043 }
dimension_type Parma_Polyhedra_Library::Variable::id | ( | ) | const [inline] |
Returns the index of the Cartesian axis associated to the variable.
Definition at line 46 of file Variable.inlines.hh.
References varid.
Referenced by Parma_Polyhedra_Library::BD_Shape< T >::affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::affine_preimage(), Parma_Polyhedra_Library::Linear_Expression::coefficient(), Parma_Polyhedra_Library::Generator::coefficient(), Parma_Polyhedra_Library::Constraint::coefficient(), Parma_Polyhedra_Library::Congruence::coefficient(), cxx_Variable_output_function(), default_output_function(), Parma_Polyhedra_Library::Polyhedron::expand_space_dimension(), Parma_Polyhedra_Library::Grid::expand_space_dimension(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_preimage(), less(), Parma_Polyhedra_Library::Linear_Expression::Linear_Expression(), OK(), and ppl_Polyhedron_map_space_dimensions().
00046 { 00047 return varid; 00048 }
dimension_type Parma_Polyhedra_Library::Variable::max_space_dimension | ( | ) | [inline, static] |
Returns the maximum space dimension a Variable can handle.
Definition at line 32 of file Variable.inlines.hh.
References Parma_Polyhedra_Library::not_a_dimension().
Referenced by OK().
00032 { 00033 return not_a_dimension() - 1; 00034 }
dimension_type Parma_Polyhedra_Library::Variable::space_dimension | ( | ) | const [inline] |
Returns the dimension of the vector space enclosing *this
.
The returned value is id()+1
.
Definition at line 51 of file Variable.inlines.hh.
References varid.
Referenced by Parma_Polyhedra_Library::Polyhedron::affine_image(), Parma_Polyhedra_Library::Grid::affine_image(), Parma_Polyhedra_Library::Polyhedron::affine_preimage(), Parma_Polyhedra_Library::Grid::affine_preimage(), Parma_Polyhedra_Library::Polyhedron::bounded_affine_image(), Parma_Polyhedra_Library::Polyhedron::bounded_affine_preimage(), Parma_Polyhedra_Library::Linear_Expression::coefficient(), Parma_Polyhedra_Library::Generator::coefficient(), Parma_Polyhedra_Library::Constraint::coefficient(), Parma_Polyhedra_Library::Congruence::coefficient(), Parma_Polyhedra_Library::Polyhedron::expand_space_dimension(), Parma_Polyhedra_Library::Grid::expand_space_dimension(), Parma_Polyhedra_Library::Polyhedron::fold_space_dimensions(), Parma_Polyhedra_Library::Grid::fold_space_dimensions(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_image(), Parma_Polyhedra_Library::Grid::generalized_affine_image(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_preimage(), Parma_Polyhedra_Library::Grid::generalized_affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::relation_with(), Parma_Polyhedra_Library::Polyhedron::throw_dimension_incompatible(), Parma_Polyhedra_Library::Grid::throw_dimension_incompatible(), Parma_Polyhedra_Library::Generator::throw_dimension_incompatible(), Parma_Polyhedra_Library::Constraint::throw_dimension_incompatible(), and Parma_Polyhedra_Library::Congruence::throw_dimension_incompatible().
00051 { 00052 return varid + 1; 00053 }
memory_size_type Parma_Polyhedra_Library::Variable::total_memory_in_bytes | ( | ) | const [inline] |
Returns the total size in bytes of the memory occupied by *this
.
Definition at line 61 of file Variable.inlines.hh.
References external_memory_in_bytes().
00061 { 00062 return sizeof(*this) + external_memory_in_bytes(); 00063 }
memory_size_type Parma_Polyhedra_Library::Variable::external_memory_in_bytes | ( | ) | const [inline] |
Returns the size in bytes of the memory managed by *this
.
Definition at line 56 of file Variable.inlines.hh.
Referenced by total_memory_in_bytes().
bool Parma_Polyhedra_Library::Variable::OK | ( | ) | const |
Checks if all the invariants are satisfied.
Definition at line 35 of file Variable.cc.
References id(), and max_space_dimension().
00035 { 00036 return id() < max_space_dimension(); 00037 }
typedef void Parma_Polyhedra_Library::Variable::output_function_type | ( | std::ostream & | s, | |
const Variable & | v | |||
) |
Type of output functions.
void Parma_Polyhedra_Library::Variable::set_output_function | ( | output_function_type * | p | ) | [inline, static] |
Sets the output function to be used for printing Variable objects.
Definition at line 66 of file Variable.inlines.hh.
References current_output_function.
Referenced by Parma_Polyhedra_Library::Init::Init().
00066 { 00067 current_output_function = p; 00068 }
Variable::output_function_type * Parma_Polyhedra_Library::Variable::get_output_function | ( | ) | [inline, static] |
Returns the pointer to the current output function.
Definition at line 71 of file Variable.inlines.hh.
References current_output_function.
00071 { 00072 return current_output_function; 00073 }
void Parma_Polyhedra_Library::Variable::default_output_function | ( | std::ostream & | s, | |
const Variable & | v | |||
) | [static, private] |
The default output function.
Definition at line 40 of file Variable.cc.
Referenced by Parma_Polyhedra_Library::Init::Init().
00040 { 00041 dimension_type varid = v.id(); 00042 s << static_cast<char>('A' + varid % 26); 00043 if (dimension_type i = varid / 26) 00044 s << i; 00045 }
friend class Init [friend] |
Definition at line 133 of file Variable.defs.hh.
std::ostream & operator<< | ( | std::ostream & | s, | |
const Variable & | v | |||
) | [friend] |
Defines a total ordering on variables.
Definition at line 77 of file Variable.inlines.hh.
References id().
Referenced by Parma_Polyhedra_Library::Variable::Compare::operator()().
The index of the Cartesian axis.
Definition at line 130 of file Variable.defs.hh.
Referenced by default_output_function(), id(), and space_dimension().
PPL::Variable::output_function_type * Parma_Polyhedra_Library::Variable::current_output_function = 0 [static, private] |
Pointer to the current output function.
Definition at line 140 of file Variable.defs.hh.
Referenced by get_output_function(), and set_output_function().