00001 /* Variable class implementation: inline functions. 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_inlines_hh 00024 #define PPL_Variable_inlines_hh 1 00025 00026 #include "globals.defs.hh" 00027 #include <stdexcept> 00028 00029 namespace Parma_Polyhedra_Library { 00030 00031 inline dimension_type 00032 Variable::max_space_dimension() { 00033 return not_a_dimension() - 1; 00034 } 00035 00036 inline 00037 Variable::Variable(dimension_type i) 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 } 00044 00045 inline dimension_type 00046 Variable::id() const { 00047 return varid; 00048 } 00049 00050 inline dimension_type 00051 Variable::space_dimension() const { 00052 return varid + 1; 00053 } 00054 00055 inline memory_size_type 00056 Variable::external_memory_in_bytes() const { 00057 return 0; 00058 } 00059 00060 inline memory_size_type 00061 Variable::total_memory_in_bytes() const { 00062 return sizeof(*this) + external_memory_in_bytes(); 00063 } 00064 00065 inline void 00066 Variable::set_output_function(output_function_type* p) { 00067 current_output_function = p; 00068 } 00069 00070 inline Variable::output_function_type* 00071 Variable::get_output_function() { 00072 return current_output_function; 00073 } 00074 00076 inline bool 00077 less(const Variable v, const Variable w) { 00078 return v.id() < w.id(); 00079 } 00080 00081 inline bool 00082 Variable::Compare::operator()(const Variable x, const Variable y) const { 00083 return less(x, y); 00084 } 00085 00086 } // namespace Parma_Polyhedra_Library 00087 00088 #endif // !defined(PPL_Variable_inlines_hh)