00001 /* Determinate class declaration. 00002 Copyright (C) 2001-2006 Roberto Bagnara <bagnara@cs.unipr.it> 00003 00004 This file is part of the Parma Polyhedra Library (PPL). 00005 00006 The PPL is free software; you can redistribute it and/or modify it 00007 under the terms of the GNU General Public License as published by the 00008 Free Software Foundation; either version 2 of the License, or (at your 00009 option) any later version. 00010 00011 The PPL is distributed in the hope that it will be useful, but WITHOUT 00012 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00013 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00014 for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software Foundation, 00018 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. 00019 00020 For the most up-to-date information see the Parma Polyhedra Library 00021 site: http://www.cs.unipr.it/ppl/ . */ 00022 00023 #ifndef PPL_Determinate_defs_hh 00024 #define PPL_Determinate_defs_hh 00025 00026 #include "Determinate.types.hh" 00027 #include "Constraint_System.types.hh" 00028 #include "Congruence_System.types.hh" 00029 #include "Variable.defs.hh" 00030 #include "globals.types.hh" 00031 #include <iosfwd> 00032 #include <cassert> 00033 00034 namespace Parma_Polyhedra_Library { 00035 00042 template <typename PH> 00043 bool operator==(const Determinate<PH>& x, const Determinate<PH>& y); 00044 00051 template <typename PH> 00052 bool operator!=(const Determinate<PH>& x, const Determinate<PH>& y); 00053 00054 namespace IO_Operators { 00055 00057 00058 template <typename PH> 00059 std::ostream& 00060 operator<<(std::ostream&, const Determinate<PH>&); 00061 00062 } // namespace IO_Operators 00063 00064 } // namespace Parma_Polyhedra_Library 00065 00067 00068 template <typename PH> 00069 class Parma_Polyhedra_Library::Determinate { 00070 public: 00072 00073 00078 Determinate(const PH& p); 00079 00084 Determinate(const Constraint_System& cs); 00085 00089 Determinate(const Congruence_System& cgs); 00090 00092 Determinate(const Determinate& y); 00093 00095 ~Determinate(); 00096 00098 00100 00101 00103 const PH& element() const; 00104 00109 bool is_top() const; 00110 00115 bool is_bottom() const; 00116 00118 bool definitely_entails(const Determinate& y) const; 00119 00124 bool is_definitely_equivalent_to(const Determinate& y) const; 00125 00130 memory_size_type total_memory_in_bytes() const; 00131 00136 memory_size_type external_memory_in_bytes() const; 00137 00139 bool OK() const; 00140 00142 00143 00145 00146 00148 void upper_bound_assign(const Determinate& y); 00149 00151 void meet_assign(const Determinate& y); 00152 00157 void concatenate_assign(const Determinate& y); 00158 00160 PH& element(); 00161 00162 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 00163 00167 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 00168 void mutate(); 00169 00171 Determinate& operator=(const Determinate& y); 00172 00174 void swap(Determinate& y); 00175 00177 00178 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 00180 00192 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 00193 template <typename Binary_Operator_Assign> 00194 class Binary_Operator_Assign_Lifter { 00195 public: 00197 explicit 00198 Binary_Operator_Assign_Lifter(Binary_Operator_Assign op_assign); 00199 00201 void operator()(Determinate& x, const Determinate& y) const; 00202 00203 private: 00205 Binary_Operator_Assign op_assign_; 00206 }; 00207 00208 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 00209 00213 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 00214 template <typename Binary_Operator_Assign> 00215 static Binary_Operator_Assign_Lifter<Binary_Operator_Assign> 00216 lift_op_assign(Binary_Operator_Assign op_assign); 00217 00218 private: 00220 00225 class Rep { 00226 private: 00233 mutable unsigned long references; 00234 00236 Rep& operator=(const Rep& y); 00237 00239 Rep(const Rep& y); 00240 00242 Rep(); 00243 00244 public: 00246 PH ph; 00247 00252 Rep(dimension_type num_dimensions, Degenerate_Element kind); 00253 00255 Rep(const PH& p); 00256 00258 Rep(const Constraint_System& cs); 00259 00261 Rep(const Congruence_System& cgs); 00262 00264 ~Rep(); 00265 00267 void new_reference() const; 00268 00273 bool del_reference() const; 00274 00276 bool is_shared() const; 00277 00282 memory_size_type total_memory_in_bytes() const; 00283 00288 memory_size_type external_memory_in_bytes() const; 00289 }; 00290 00295 Rep* prep; 00296 00297 friend bool 00298 operator==<PH>(const Determinate<PH>& x, const Determinate<PH>& y); 00299 friend bool 00300 operator!=<PH>(const Determinate<PH>& x, const Determinate<PH>& y); 00301 }; 00302 00303 00304 namespace std { 00305 00307 00308 template <typename PH> 00309 void swap(Parma_Polyhedra_Library::Determinate<PH>& x, 00310 Parma_Polyhedra_Library::Determinate<PH>& y); 00311 00312 } // namespace std 00313 00314 #include "Determinate.inlines.hh" 00315 00316 #endif // !defined(PPL_Determinate_defs_hh)