PPL  1.2
Determinate_defs.hh
Go to the documentation of this file.
1 /* Determinate 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_Determinate_defs_hh
25 #define PPL_Determinate_defs_hh
26 
27 #include "Determinate_types.hh"
30 #include "Variable_defs.hh"
31 #include "globals_types.hh"
32 #include <iosfwd>
33 
34 namespace Parma_Polyhedra_Library {
35 
37 
38 template <typename PSET>
39 void swap(Determinate<PSET>& x, Determinate<PSET>& y);
40 
47 template <typename PSET>
48 bool operator==(const Determinate<PSET>& x, const Determinate<PSET>& y);
49 
56 template <typename PSET>
57 bool operator!=(const Determinate<PSET>& x, const Determinate<PSET>& y);
58 
59 namespace IO_Operators {
60 
62 
63 template <typename PSET>
64 std::ostream&
65 operator<<(std::ostream&, const Determinate<PSET>&);
66 
67 } // namespace IO_Operators
68 
69 } // namespace Parma_Polyhedra_Library
70 
83 template <typename PSET>
85 public:
87 
88 
92  Determinate(const PSET& pset);
93 
98  Determinate(const Constraint_System& cs);
99 
104  Determinate(const Congruence_System& cgs);
105 
107  Determinate(const Determinate& y);
108 
110  ~Determinate();
111 
113 
115 
116 
118  const PSET& pointset() const;
119 
124  bool is_top() const;
125 
130  bool is_bottom() const;
131 
133  bool definitely_entails(const Determinate& y) const;
134 
139  bool is_definitely_equivalent_to(const Determinate& y) const;
140 
146 
152 
157  static bool has_nontrivial_weakening();
158 
160  bool OK() const;
161 
163 
164 
166 
167 
169  void upper_bound_assign(const Determinate& y);
170 
172  void meet_assign(const Determinate& y);
173 
175  void weakening_assign(const Determinate& y);
176 
181  void concatenate_assign(const Determinate& y);
182 
184  PSET& pointset();
185 
186 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
187 
191 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
192  void mutate();
193 
195  Determinate& operator=(const Determinate& y);
196 
198  void m_swap(Determinate& y);
199 
201 
202 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
203 
216 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
217  template <typename Binary_Operator_Assign>
219  public:
221  explicit
222  Binary_Operator_Assign_Lifter(Binary_Operator_Assign op_assign);
223 
225  void operator()(Determinate& x, const Determinate& y) const;
226 
227  private:
229  Binary_Operator_Assign op_assign_;
230  };
231 
232 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
233 
237 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
238  template <typename Binary_Operator_Assign>
240  lift_op_assign(Binary_Operator_Assign op_assign);
241 
242 private:
244 
249  class Rep {
250  private:
257  mutable unsigned long references;
258 
260  Rep& operator=(const Rep& y);
261 
263  Rep(const Rep& y);
264 
266  Rep();
267 
268  public:
270  PSET pset;
271 
276  Rep(dimension_type num_dimensions, Degenerate_Element kind);
277 
279  Rep(const PSET& p);
280 
282  Rep(const Constraint_System& cs);
283 
285  Rep(const Congruence_System& cgs);
286 
288  ~Rep();
289 
291  void new_reference() const;
292 
297  bool del_reference() const;
298 
300  bool is_shared() const;
301 
307 
313  };
314 
320 
321  friend bool
322  operator==<PSET>(const Determinate<PSET>& x, const Determinate<PSET>& y);
323 
324  friend bool
325  operator!=<PSET>(const Determinate<PSET>& x, const Determinate<PSET>& y);
326 };
327 
328 #include "Determinate_inlines.hh"
329 
330 #endif // !defined(PPL_Determinate_defs_hh)
static Binary_Operator_Assign_Lifter< Binary_Operator_Assign > lift_op_assign(Binary_Operator_Assign op_assign)
Helper function returning a Binary_Operator_Assign_Lifter object, also allowing for the deduction of ...
bool operator!=(const Box< ITV > &x, const Box< ITV > &y)
Definition: Box_inlines.hh:264
void new_reference() const
Registers a new reference.
The possibly shared representation of a Determinate object.
memory_size_type external_memory_in_bytes() const
Returns a lower bound to the size in bytes of the memory managed by *this.
void swap(CO_Tree &x, CO_Tree &y)
size_t dimension_type
An unsigned integral type for representing space dimensions.
memory_size_type total_memory_in_bytes() const
Returns a lower bound to the total size in bytes of the memory occupied by *this. ...
bool is_top() const
Returns true if and only if *this embeds the universe element PSET.
Determinate & operator=(const Determinate &y)
Assignment operator.
void weakening_assign(const Determinate &y)
Assigns to *this the result of weakening *this with y.
void operator()(Determinate &x, const Determinate &y) const
Function-application operator.
void concatenate_assign(const Determinate &y)
Assigns to *this the concatenation of *this and y, taken in this order.
bool is_definitely_equivalent_to(const Determinate &y) const
Returns true if and only if *this and y are definitely equivalent.
void upper_bound_assign(const Determinate &y)
Assigns to *this the upper bound of *this and y.
void mutate()
On return from this method, the representation of *this is not shared by different Determinate object...
A wrapper for PPL pointsets, providing them with a determinate constraint system interface, as defined in [Bag98].
Determinate(const PSET &pset)
Constructs a COW-wrapped object corresponding to the pointset pset.
bool OK() const
Checks if all the invariants are satisfied.
bool definitely_entails(const Determinate &y) const
Returns true if and only if *this entails y.
Binary_Operator_Assign_Lifter(Binary_Operator_Assign op_assign)
Explicit unary constructor.
Degenerate_Element
Kinds of degenerate abstract elements.
Rep * prep
A pointer to the possibly shared representation of the base-level domain element. ...
bool is_bottom() const
Returns true if and only if *this embeds the empty element of PSET.
memory_size_type external_memory_in_bytes() const
Returns a lower bound to the size in bytes of the memory managed by *this.
The entire library is confined to this namespace.
Definition: version.hh:61
memory_size_type total_memory_in_bytes() const
Returns a lower bound to the total size in bytes of the memory occupied by *this. ...
unsigned long references
Count the number of references:
Binary_Operator_Assign op_assign_
The function object to be lifted.
PSET pset
The possibly shared, embedded pointset.
bool del_reference() const
Unregisters one reference; returns true if and only if the representation has become unreferenced...
bool is_shared() const
True if and only if this representation is currently shared.
Rep & operator=(const Rep &y)
Private and unimplemented: assignment not allowed.
bool operator==(const Box< ITV > &x, const Box< ITV > &y)
void meet_assign(const Determinate &y)
Assigns to *this the meet of *this and y.
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
void m_swap(Determinate &y)
Swaps *this with y.
Rep()
Private and unimplemented: default construction not allowed.
const PSET & pointset() const
Returns a const reference to the embedded pointset.