00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef PPL_Bit_Row_defs_hh
00025 #define PPL_Bit_Row_defs_hh 1
00026
00027 #include "Bit_Row.types.hh"
00028 #include "globals.types.hh"
00029 #include <iosfwd>
00030 #include <gmpxx.h>
00031 #include <vector>
00032
00033 namespace Parma_Polyhedra_Library {
00034
00035
00036
00037 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00038
00039
00040 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00041 bool operator==(const Bit_Row& x, const Bit_Row& y);
00042
00043 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00044
00045
00046 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00047 bool operator!=(const Bit_Row& x, const Bit_Row& y);
00048
00049 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00050
00051
00062 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00063 int compare(const Bit_Row& x, const Bit_Row& y);
00064
00065 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00066
00067
00068 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00069 bool subset_or_equal(const Bit_Row& x, const Bit_Row& y);
00070
00071 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00072
00078 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00079 bool subset_or_equal(const Bit_Row& x, const Bit_Row& y,
00080 bool& strict_subset);
00081
00082 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00083
00084
00085 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00086 bool strict_subset(const Bit_Row& x, const Bit_Row& y);
00087
00088 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00089
00090
00091 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00092 void set_union(const Bit_Row& x, const Bit_Row& y, Bit_Row& z);
00093
00094 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00095
00096
00097 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00098 void set_intersection(const Bit_Row& x, const Bit_Row& y, Bit_Row& z);
00099
00100 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00101
00102
00103 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00104 void set_difference(const Bit_Row& x, const Bit_Row& y, Bit_Row& z);
00105
00106 }
00107
00108 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00109
00110
00111 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00112 class Parma_Polyhedra_Library::Bit_Row {
00113 public:
00115 Bit_Row();
00116
00118 Bit_Row(const Bit_Row& y);
00119
00121
00124 Bit_Row(const Bit_Row& y, const Bit_Row& z);
00125
00127 ~Bit_Row();
00128
00130 Bit_Row& operator=(const Bit_Row& y);
00131
00133 void swap(Bit_Row& y);
00134
00136 bool operator[](unsigned long k) const;
00137
00139 void set(unsigned long k);
00140
00142 void set_until(unsigned long k);
00143
00145 void clear(unsigned long k);
00146
00148 void clear_from(unsigned long k);
00149
00151 void clear();
00152
00153 friend int compare(const Bit_Row& x, const Bit_Row& y);
00154 friend bool operator==(const Bit_Row& x, const Bit_Row& y);
00155 friend bool operator!=(const Bit_Row& x, const Bit_Row& y);
00156 friend bool subset_or_equal(const Bit_Row& x, const Bit_Row& y);
00157 friend bool subset_or_equal(const Bit_Row& x, const Bit_Row& y,
00158 bool& strict_subset);
00159 friend bool strict_subset(const Bit_Row& x, const Bit_Row& y);
00160 friend void set_union(const Bit_Row& x, const Bit_Row& y, Bit_Row& z);
00161 friend void set_intersection(const Bit_Row& x, const Bit_Row& y, Bit_Row& z);
00162 friend void set_difference(const Bit_Row& x, const Bit_Row& y, Bit_Row& z);
00163
00165 unsigned long first() const;
00166
00171 unsigned long next(unsigned long position) const;
00172
00174 unsigned long last() const;
00175
00180 unsigned long prev(unsigned long position) const;
00181
00183 unsigned long count_ones() const;
00184
00186 bool empty() const;
00187
00189 memory_size_type total_memory_in_bytes() const;
00190
00192 memory_size_type external_memory_in_bytes() const;
00193
00195 bool OK() const;
00196
00197 private:
00199 mpz_t vec;
00200
00202
00206 void union_helper(const Bit_Row& x, const Bit_Row& y);
00207 };
00208
00209 namespace std {
00210
00211 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00212
00213
00214 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00215 void swap(Parma_Polyhedra_Library::Bit_Row& x,
00216 Parma_Polyhedra_Library::Bit_Row& y);
00217
00218 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00219
00220
00221 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00222 void
00223 iter_swap(std::vector<Parma_Polyhedra_Library::Bit_Row>::iterator x,
00224 std::vector<Parma_Polyhedra_Library::Bit_Row>::iterator y);
00225
00226 }
00227
00228 #include "Bit_Row.inlines.hh"
00229
00230 #endif // !defined(PPL_Bit_Row_defs_hh)