PPL  1.2
DB_Row_defs.hh
Go to the documentation of this file.
1 /* DB_Row class declaration.
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_DB_Row_defs_hh
25 #define PPL_DB_Row_defs_hh 1
26 
27 #include "DB_Row_types.hh"
28 #include "globals_types.hh"
29 #include "Ptr_Iterator_defs.hh"
30 #include <cstddef>
31 #include <vector>
32 
33 #ifndef PPL_DB_ROW_EXTRA_DEBUG
34 #ifdef PPL_ABI_BREAKING_EXTRA_DEBUG
35 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
36 
42 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
43 #define PPL_DB_ROW_EXTRA_DEBUG 1
44 #else // !defined(PPL_ABI_BREAKING_EXTRA_DEBUG)
45 #define PPL_DB_ROW_EXTRA_DEBUG 0
46 #endif // !defined(PPL_ABI_BREAKING_EXTRA_DEBUG)
47 #endif // !defined(PPL_DB_ROW_EXTRA_DEBUG)
48 
49 
50 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
51 
56 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
57 template <typename T>
59 public:
62 
65 
66  class Impl;
67 
69  Impl* impl;
70 
71 #if PPL_DB_ROW_EXTRA_DEBUG
72  dimension_type capacity_;
74 #endif // PPL_DB_ROW_EXTRA_DEBUG
75 
76 private:
79 
82 };
83 
84 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
85 
118 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
119 template <typename T>
121 public:
123  DB_Row();
124 
126 
127 
131  void construct(dimension_type sz);
132 
134 
145  void construct(dimension_type sz, dimension_type capacity);
146 
148 
159  template <typename U>
161  dimension_type capacity);
162 
164 
167 
169  DB_Row(dimension_type sz, dimension_type capacity);
170 
172  DB_Row(const DB_Row& y);
173 
175 
178  DB_Row(const DB_Row& y, dimension_type capacity);
179 
181 
186  DB_Row(const DB_Row& y, dimension_type sz, dimension_type capacity);
187 
189  ~DB_Row();
190 
192  DB_Row& operator=(const DB_Row& y);
193 
195  void m_swap(DB_Row& y);
196 
198  void assign(DB_Row& y);
199 
208  void allocate(dimension_type capacity);
209 
211 
218  void expand_within_capacity(dimension_type new_size);
219 
221 
226  void shrink(dimension_type new_size);
227 
229  static dimension_type max_size();
230 
232  dimension_type size() const;
233 
235 
238 
240  const T& operator[](dimension_type k) const;
242 
245 
248 
254  iterator begin();
255 
257  iterator end();
258 
264  const_iterator begin() const;
265 
267  const_iterator end() const;
268 
274 
280 
286 
292 
294  bool OK(dimension_type row_size, dimension_type row_capacity) const;
295 
296 private:
297  template <typename U> friend class Parma_Polyhedra_Library::DB_Row;
298 
300  void copy_construct_coefficients(const DB_Row& y);
301 
302 #if PPL_DB_ROW_EXTRA_DEBUG
303  dimension_type capacity() const;
305 #endif // PPL_DB_ROW_EXTRA_DEBUG
306 };
307 
308 namespace Parma_Polyhedra_Library {
309 
310 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
311 
313 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
314 template <typename T>
315 void swap(DB_Row<T>& x, DB_Row<T>& y);
316 
317 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
318 
320 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
321 template <typename T>
322 void iter_swap(typename std::vector<DB_Row<T> >::iterator x,
323  typename std::vector<DB_Row<T> >::iterator y);
324 
325 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
326 
328 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
329 
330 template <typename T>
331 bool operator==(const DB_Row<T>& x, const DB_Row<T>& y);
332 
334 template <typename T>
335 bool operator!=(const DB_Row<T>& x, const DB_Row<T>& y);
336 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
337 
338 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
339 
340 } // namespace Parma_Polyhedra_Library
341 
342 
343 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
344 
350 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
351 template <typename T>
353 public:
355 
356 
362  static void* operator new(size_t fixed_size, dimension_type capacity);
363 
365  static void operator delete(void* p);
366 
371  static void operator delete(void* p, dimension_type capacity);
373 
375  Impl();
376 
378 
382  ~Impl();
383 
385 
388  void expand_within_capacity(dimension_type new_size);
389 
391 
394  void shrink(dimension_type new_size);
395 
397  void copy_construct_coefficients(const Impl& y);
398 
403  template <typename U>
404  void construct_upward_approximation(const U& y);
405 
407  static dimension_type max_size();
408 
410 
411  dimension_type size() const;
413 
415  void set_size(dimension_type new_sz);
416 
418  void bump_size();
420 
422 
423  T& operator[](dimension_type k);
425 
427  const T& operator[](dimension_type k) const;
429 
435 
438 
441 
442 private:
443  friend class DB_Row<T>;
444 
447 
449  T vec_[
450 #if PPL_CXX_SUPPORTS_ZERO_LENGTH_ARRAYS
451  0
452 #else
453  1
454 #endif
455  ];
456 
458  Impl(const Impl& y);
459 
461  Impl& operator=(const Impl&);
462 
464  void copy_construct(const Impl& y);
465 };
466 
467 #include "DB_Row_inlines.hh"
468 #include "DB_Row_templates.hh"
469 
470 #endif // !defined(PPL_DB_Row_defs_hh)
void assign(DB_Row &y)
Assigns the implementation of y to *this.
bool operator!=(const Box< ITV > &x, const Box< ITV > &y)
Definition: Box_inlines.hh:264
DB_Row_Impl_Handler & operator=(const DB_Row_Impl_Handler &)
Private and unimplemented: copy assignment is not allowed.
void swap(CO_Tree &x, CO_Tree &y)
void m_swap(DB_Row &y)
Swaps *this with y.
size_t dimension_type
An unsigned integral type for representing space dimensions.
A class to define STL const and non-const iterators from pointer types.
memory_size_type total_memory_in_bytes() const
Returns a lower bound to the total size in bytes of the memory occupied by *this. ...
DB_Row & operator=(const DB_Row &y)
Assignment operator.
void expand_within_capacity(dimension_type new_size)
Expands the row to size new_size.
T & operator[](dimension_type k)
Returns a reference to the element of the row indexed by k.
void allocate(dimension_type capacity)
Allocates memory for a default constructed DB_Row object, allowing for capacity coefficients at most...
The base class for the single rows of matrices.
Definition: DB_Row_defs.hh:120
Implementation::Ptr_Iterator< T * > iterator
A (non const) random access iterator to access the row's elements.
Definition: DB_Row_defs.hh:244
Implementation::Ptr_Iterator< const T * > const_iterator
A const random access iterator to access the row's elements.
Definition: DB_Row_defs.hh:247
Enable_If< Is_Native< T >::value, memory_size_type >::type external_memory_in_bytes(const T &)
For native types, returns the size in bytes of the memory managed by the type of the (unused) paramet...
dimension_type size_
The number of coefficients in the row.
Definition: DB_Row_defs.hh:446
The real implementation of a DB_Row object.
Definition: DB_Row_defs.hh:352
bool OK(dimension_type row_size, dimension_type row_capacity) const
Checks if all the invariants are satisfied.
void shrink(dimension_type new_size)
Shrinks the row by erasing elements at the end.
iterator end()
Returns the past-the-end iterator.
The entire library is confined to this namespace.
Definition: version.hh:61
void construct_upward_approximation(const DB_Row< U > &y, dimension_type capacity)
Constructs properly a conservative approximation of y.
iterator begin()
Returns the const iterator pointing to the first element, if *this is not empty; otherwise, returns the past-the-end const iterator.
dimension_type size() const
Gives the number of coefficients currently in use.
DB_Row()
Pre-constructs a row: construction must be completed by construct().
bool operator==(const Box< ITV > &x, const Box< ITV > &y)
static dimension_type max_size()
Returns the size() of the largest possible DB_Row.
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
memory_size_type external_memory_in_bytes() const
Returns a lower bound to the size in bytes of the memory managed by *this.
Enable_If< Is_Native< T >::value, memory_size_type >::type total_memory_in_bytes(const T &)
For native types, returns the total size in bytes of the memory occupied by the type of the (unused) ...
The handler of the actual DB_Row implementation.
Definition: DB_Row_defs.hh:58
void copy_construct_coefficients(const DB_Row &y)
Exception-safe copy construction mechanism for coefficients.
void construct(dimension_type sz)
Constructs properly a default-constructed element.
Impl * impl
A pointer to the actual implementation.
Definition: DB_Row_defs.hh:66