PPL  1.2
Variables_Set_inlines.hh
Go to the documentation of this file.
1 /* Variables_Set class implementation: inline functions.
2  Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3  Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #ifndef PPL_Variables_Set_inlines_hh
25 #define PPL_Variables_Set_inlines_hh 1
26 
27 #include "globals_defs.hh"
28 #include <stdexcept>
29 
30 namespace Parma_Polyhedra_Library {
31 
32 inline
34  : Base() {
35 }
36 
37 inline void
39  insert(v.id());
40 }
41 
42 inline
44  : Base() {
45  insert(v);
46 }
47 
48 inline dimension_type
51 }
52 
53 inline dimension_type
55  reverse_iterator i = rbegin();
56  return (i == rend()) ? 0 : (*i + 1);
57 }
58 
59 inline memory_size_type
61  // We assume sets are implemented by means of red-black trees that
62  // require to store the color (we assume an enum) and three pointers
63  // to the parent, left and right child, respectively.
64  enum color { red, black };
65  return size() * (sizeof(color) + 3*sizeof(void*) + sizeof(dimension_type));
66 }
67 
68 inline memory_size_type
70  return sizeof(*this) + external_memory_in_bytes();
71 }
72 
73 } // namespace Parma_Polyhedra_Library
74 
75 #endif // !defined(PPL_Variables_Set_inlines_hh)
dimension_type space_dimension() const
Returns the dimension of the smallest vector space enclosing all the variables whose indexes are in t...
size_t dimension_type
An unsigned integral type for representing space dimensions.
static dimension_type max_space_dimension()
Returns the maximum space dimension a Variable can handle.
dimension_type id() const
Returns the index of the Cartesian axis associated to the variable.
A dimension of the vector space.
static dimension_type max_space_dimension()
Returns the maximum space dimension a Variables_Set can handle.
memory_size_type total_memory_in_bytes() const
Returns the total size in bytes of the memory occupied by *this.
The entire library is confined to this namespace.
Definition: version.hh:61
void insert(Variable v)
Inserts the index of variable v into the set.
Variables_Set()
Builds the empty set of variable indexes.
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.