00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PPL_Bit_Row_defs_hh
00024 #define PPL_Bit_Row_defs_hh 1
00025
00026 #include "Bit_Row.types.hh"
00027 #include "globals.types.hh"
00028 #include <iosfwd>
00029 #include <gmpxx.h>
00030 #include <vector>
00031
00032 namespace Parma_Polyhedra_Library {
00033
00034
00035
00036 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00038
00039 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00040 bool operator==(const Bit_Row& x, const Bit_Row& y);
00041
00042 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00044
00045 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00046 bool operator!=(const Bit_Row& x, const Bit_Row& y);
00047
00048 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00050
00061 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00062 int compare(const Bit_Row& x, const Bit_Row& y);
00063
00064 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00066
00067 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00068 bool subset_or_equal(const Bit_Row& x, const Bit_Row& y);
00069
00070 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00071
00077 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00078 bool subset_or_equal(const Bit_Row& x, const Bit_Row& y,
00079 bool& strict_subset);
00080
00081 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00083
00084 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00085 bool strict_subset(const Bit_Row& x, const Bit_Row& y);
00086
00087 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00089
00090 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00091 void set_union(const Bit_Row& x, const Bit_Row& y, Bit_Row& z);
00092
00093 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00095
00096 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00097 void set_intersection(const Bit_Row& x, const Bit_Row& y, Bit_Row& z);
00098
00099 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00101
00102 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00103 void set_difference(const Bit_Row& x, const Bit_Row& y, Bit_Row& z);
00104
00105 }
00106
00107 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00109
00110 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00111 class Parma_Polyhedra_Library::Bit_Row {
00112 public:
00114 Bit_Row();
00115
00117 Bit_Row(const Bit_Row& y);
00118
00120 ~Bit_Row();
00121
00123 Bit_Row& operator=(const Bit_Row& y);
00124
00126 void swap(Bit_Row& y);
00127
00129 bool operator[](unsigned long k) const;
00130
00132 void set(unsigned long k);
00133
00135 void set_until(unsigned long k);
00136
00138 void clear(unsigned long k);
00139
00141 void clear_from(unsigned long k);
00142
00144 void clear();
00145
00146 friend int compare(const Bit_Row& x, const Bit_Row& y);
00147 friend bool operator==(const Bit_Row& x, const Bit_Row& y);
00148 friend bool operator!=(const Bit_Row& x, const Bit_Row& y);
00149 friend bool subset_or_equal(const Bit_Row& x, const Bit_Row& y);
00150 friend bool subset_or_equal(const Bit_Row& x, const Bit_Row& y,
00151 bool& strict_subset);
00152 friend bool strict_subset(const Bit_Row& x, const Bit_Row& y);
00153 friend void set_union(const Bit_Row& x, const Bit_Row& y, Bit_Row& z);
00154 friend void set_intersection(const Bit_Row& x, const Bit_Row& y, Bit_Row& z);
00155 friend void set_difference(const Bit_Row& x, const Bit_Row& y, Bit_Row& z);
00156
00158 unsigned long first() const;
00159
00164 unsigned long next(unsigned long position) const;
00165
00167 unsigned long last() const;
00168
00173 unsigned long prev(unsigned long position) const;
00174
00176 unsigned long count_ones() const;
00177
00179 bool empty() const;
00180
00182 memory_size_type total_memory_in_bytes() const;
00183
00185 memory_size_type external_memory_in_bytes() const;
00186
00188 bool OK() const;
00189
00190 private:
00192 mpz_t vec;
00193
00195 static unsigned int first_one(mp_limb_t w);
00196
00198 static unsigned int last_one(mp_limb_t w);
00199 };
00200
00201 namespace std {
00202
00203 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00205
00206 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00207 void swap(Parma_Polyhedra_Library::Bit_Row& x,
00208 Parma_Polyhedra_Library::Bit_Row& y);
00209
00210 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00212
00213 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00214 void
00215 iter_swap(std::vector<Parma_Polyhedra_Library::Bit_Row>::iterator x,
00216 std::vector<Parma_Polyhedra_Library::Bit_Row>::iterator y);
00217
00218 }
00219
00220 #include "Bit_Row.inlines.hh"
00221
00222 #endif // !defined(PPL_Bit_Row_defs_hh)