00001 /* Variable class declaration. 00002 Copyright (C) 2001-2006 Roberto Bagnara <bagnara@cs.unipr.it> 00003 00004 This file is part of the Parma Polyhedra Library (PPL). 00005 00006 The PPL is free software; you can redistribute it and/or modify it 00007 under the terms of the GNU General Public License as published by the 00008 Free Software Foundation; either version 2 of the License, or (at your 00009 option) any later version. 00010 00011 The PPL is distributed in the hope that it will be useful, but WITHOUT 00012 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00013 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00014 for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software Foundation, 00018 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. 00019 00020 For the most up-to-date information see the Parma Polyhedra Library 00021 site: http://www.cs.unipr.it/ppl/ . */ 00022 00023 #ifndef PPL_Variable_defs_hh 00024 #define PPL_Variable_defs_hh 1 00025 00026 #include "Variable.types.hh" 00027 #include "Init.types.hh" 00028 #include "globals.types.hh" 00029 #include <iosfwd> 00030 #include <set> 00031 00032 namespace Parma_Polyhedra_Library { 00033 00034 namespace IO_Operators { 00035 00037 00038 std::ostream& 00039 operator<<(std::ostream& s, const Variable& v); 00040 00041 } // namespace IO_Operators 00042 00044 00045 bool less(Variable v, Variable w); 00046 00047 } // namespace Parma_Polyhedra_Library 00048 00050 00080 class Parma_Polyhedra_Library::Variable { 00081 00082 public: 00084 00089 explicit Variable(dimension_type i); 00090 00092 dimension_type id() const; 00093 00095 static dimension_type max_space_dimension(); 00096 00098 00101 dimension_type space_dimension() const; 00102 00104 memory_size_type total_memory_in_bytes() const; 00105 00107 memory_size_type external_memory_in_bytes() const; 00108 00110 bool OK() const; 00111 00113 typedef void output_function_type(std::ostream& s, const Variable& v); 00114 00116 static void set_output_function(output_function_type* p); 00117 00119 static output_function_type* get_output_function(); 00120 00122 00123 struct Compare { 00125 bool operator()(Variable x, Variable y) const; 00126 }; 00127 00128 private: 00130 dimension_type varid; 00131 00132 // The initialization class needs to set the default output function. 00133 friend class Init; 00134 00135 friend std::ostream& 00136 Parma_Polyhedra_Library::IO_Operators::operator<<(std::ostream& s, 00137 const Variable& v); 00138 00140 static output_function_type* current_output_function; 00141 00143 static void default_output_function(std::ostream& s, const Variable& v); 00144 }; 00145 00146 #include "Variable.inlines.hh" 00147 00148 namespace Parma_Polyhedra_Library { 00149 00151 00152 typedef std::set<Variable, Variable::Compare> Variables_Set; 00153 00154 } // namespace Parma_Polyhedra_Library 00155 00156 #endif // !defined(PPL_Variable_defs_hh)