00001 /* Variables_Set 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_Variables_Set_inlines_hh 00025 #define PPL_Variables_Set_inlines_hh 1 00026 00027 #include "globals.defs.hh" 00028 #include <stdexcept> 00029 00030 namespace Parma_Polyhedra_Library { 00031 00032 inline 00033 Variables_Set::Variables_Set() 00034 : Base() { 00035 } 00036 00037 inline void 00038 Variables_Set::insert(const Variable v) { 00039 insert(v.id()); 00040 } 00041 00042 inline 00043 Variables_Set::Variables_Set(const Variable& v) 00044 : Base() { 00045 insert(v); 00046 } 00047 00048 inline dimension_type 00049 Variables_Set::max_space_dimension() { 00050 return Variable::max_space_dimension(); 00051 } 00052 00053 inline dimension_type 00054 Variables_Set::space_dimension() const { 00055 reverse_iterator i = rbegin(); 00056 return i == rend() ? 0 : *i+1; 00057 } 00058 00059 inline memory_size_type 00060 Variables_Set::external_memory_in_bytes() const { 00061 // We assume sets are implemented by means of red-black trees that 00062 // require to store the color (we assume an enum) and three pointers 00063 // to the parent, left and right child, respectively. 00064 enum color { red, black }; 00065 return size() * (sizeof(color) + 3*sizeof(void*) + sizeof(dimension_type)); 00066 } 00067 00068 inline memory_size_type 00069 Variables_Set::total_memory_in_bytes() const { 00070 return sizeof(*this) + external_memory_in_bytes(); 00071 } 00072 00073 } // namespace Parma_Polyhedra_Library 00074 00075 #endif // !defined(PPL_Variables_Set_inlines_hh)
1.6.3