00001 /* Variable class implementation: inline functions. 00002 Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> 00003 Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) 00004 00005 This file is part of the Parma Polyhedra Library (PPL). 00006 00007 The PPL is free software; you can redistribute it and/or modify it 00008 under the terms of the GNU General Public License as published by the 00009 Free Software Foundation; either version 3 of the License, or (at your 00010 option) any later version. 00011 00012 The PPL is distributed in the hope that it will be useful, but WITHOUT 00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00015 for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software Foundation, 00019 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. 00020 00021 For the most up-to-date information see the Parma Polyhedra Library 00022 site: http://www.cs.unipr.it/ppl/ . */ 00023 00024 #ifndef PPL_Variable_inlines_hh 00025 #define PPL_Variable_inlines_hh 1 00026 00027 #include "globals.defs.hh" 00028 #include <stdexcept> 00029 00030 namespace Parma_Polyhedra_Library { 00031 00032 inline dimension_type 00033 Variable::max_space_dimension() { 00034 return not_a_dimension() - 1; 00035 } 00036 00037 inline 00038 Variable::Variable(dimension_type i) 00039 : varid(i < max_space_dimension() 00040 ? i 00041 : (throw std::length_error("PPL::Variable::Variable(i):\n" 00042 "i exceeds the maximum allowed " 00043 "variable identifier."), i)) { 00044 } 00045 00046 inline dimension_type 00047 Variable::id() const { 00048 return varid; 00049 } 00050 00051 inline dimension_type 00052 Variable::space_dimension() const { 00053 return varid + 1; 00054 } 00055 00056 inline memory_size_type 00057 Variable::external_memory_in_bytes() const { 00058 return 0; 00059 } 00060 00061 inline memory_size_type 00062 Variable::total_memory_in_bytes() const { 00063 return sizeof(*this) + external_memory_in_bytes(); 00064 } 00065 00066 inline void 00067 Variable::set_output_function(output_function_type* p) { 00068 current_output_function = p; 00069 } 00070 00071 inline Variable::output_function_type* 00072 Variable::get_output_function() { 00073 return current_output_function; 00074 } 00075 00077 inline bool 00078 less(const Variable v, const Variable w) { 00079 return v.id() < w.id(); 00080 } 00081 00082 inline bool 00083 Variable::Compare::operator()(const Variable x, const Variable y) const { 00084 return less(x, y); 00085 } 00086 00087 } // namespace Parma_Polyhedra_Library 00088 00089 #endif // !defined(PPL_Variable_inlines_hh)
1.6.3