00001 /* Determinate class declaration. 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_Determinate_defs_hh 00025 #define PPL_Determinate_defs_hh 00026 00027 #include "Determinate.types.hh" 00028 #include "Constraint_System.types.hh" 00029 #include "Congruence_System.types.hh" 00030 #include "Variable.defs.hh" 00031 #include "globals.types.hh" 00032 #include <iosfwd> 00033 #include "assert.hh" 00034 00035 namespace Parma_Polyhedra_Library { 00036 00043 template <typename PSET> 00044 bool operator==(const Determinate<PSET>& x, const Determinate<PSET>& y); 00045 00052 template <typename PSET> 00053 bool operator!=(const Determinate<PSET>& x, const Determinate<PSET>& y); 00054 00055 namespace IO_Operators { 00056 00058 00059 template <typename PSET> 00060 std::ostream& 00061 operator<<(std::ostream&, const Determinate<PSET>&); 00062 00063 } // namespace IO_Operators 00064 00065 } // namespace Parma_Polyhedra_Library 00066 00079 template <typename PSET> 00080 class Parma_Polyhedra_Library::Determinate { 00081 public: 00083 00084 00088 Determinate(const PSET& p); 00089 00094 Determinate(const Constraint_System& cs); 00095 00100 Determinate(const Congruence_System& cgs); 00101 00103 Determinate(const Determinate& y); 00104 00106 ~Determinate(); 00107 00109 00111 00112 00114 const PSET& pointset() const; 00115 00120 bool is_top() const; 00121 00126 bool is_bottom() const; 00127 00129 bool definitely_entails(const Determinate& y) const; 00130 00135 bool is_definitely_equivalent_to(const Determinate& y) const; 00136 00141 memory_size_type total_memory_in_bytes() const; 00142 00147 memory_size_type external_memory_in_bytes() const; 00148 00153 static bool has_nontrivial_weakening(); 00154 00156 bool OK() const; 00157 00159 00160 00162 00163 00165 void upper_bound_assign(const Determinate& y); 00166 00168 void meet_assign(const Determinate& y); 00169 00171 void weakening_assign(const Determinate& y); 00172 00177 void concatenate_assign(const Determinate& y); 00178 00180 PSET& pointset(); 00181 00182 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 00183 00187 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) 00188 void mutate(); 00189 00191 Determinate& operator=(const Determinate& y); 00192 00194 void swap(Determinate& y); 00195 00197 00198 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 00199 00200 00212 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) 00213 template <typename Binary_Operator_Assign> 00214 class Binary_Operator_Assign_Lifter { 00215 public: 00217 explicit 00218 Binary_Operator_Assign_Lifter(Binary_Operator_Assign op_assign); 00219 00221 void operator()(Determinate& x, const Determinate& y) const; 00222 00223 private: 00225 Binary_Operator_Assign op_assign_; 00226 }; 00227 00228 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 00229 00233 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) 00234 template <typename Binary_Operator_Assign> 00235 static Binary_Operator_Assign_Lifter<Binary_Operator_Assign> 00236 lift_op_assign(Binary_Operator_Assign op_assign); 00237 00238 private: 00240 00245 class Rep { 00246 private: 00253 mutable unsigned long references; 00254 00256 Rep& operator=(const Rep& y); 00257 00259 Rep(const Rep& y); 00260 00262 Rep(); 00263 00264 public: 00266 PSET pset; 00267 00272 Rep(dimension_type num_dimensions, Degenerate_Element kind); 00273 00275 Rep(const PSET& p); 00276 00278 Rep(const Constraint_System& cs); 00279 00281 Rep(const Congruence_System& cgs); 00282 00284 ~Rep(); 00285 00287 void new_reference() const; 00288 00293 bool del_reference() const; 00294 00296 bool is_shared() const; 00297 00302 memory_size_type total_memory_in_bytes() const; 00303 00308 memory_size_type external_memory_in_bytes() const; 00309 }; 00310 00315 Rep* prep; 00316 00317 friend bool 00318 operator==<PSET>(const Determinate<PSET>& x, const Determinate<PSET>& y); 00319 00320 friend bool 00321 operator!=<PSET>(const Determinate<PSET>& x, const Determinate<PSET>& y); 00322 }; 00323 00324 00325 namespace std { 00326 00328 00329 template <typename PSET> 00330 void swap(Parma_Polyhedra_Library::Determinate<PSET>& x, 00331 Parma_Polyhedra_Library::Determinate<PSET>& y); 00332 00333 } // namespace std 00334 00335 #include "Determinate.inlines.hh" 00336 00337 #endif // !defined(PPL_Determinate_defs_hh)
1.6.3