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_Saturation_Matrix_inlines_hh
00024 #define PPL_Saturation_Matrix_inlines_hh 1
00025
00026 #include <algorithm>
00027 #include <cassert>
00028
00029 namespace Parma_Polyhedra_Library {
00030
00031 inline
00032 Saturation_Matrix::Saturation_Matrix()
00033 : rows(),
00034 row_size(0) {
00035 }
00036
00037 inline dimension_type
00038 Saturation_Matrix::max_num_rows() {
00039 return std::vector<Saturation_Row>().max_size();
00040 }
00041
00042 inline
00043 Saturation_Matrix::Saturation_Matrix(const dimension_type n_rows,
00044 const dimension_type n_columns)
00045 : rows(n_rows),
00046 row_size(n_columns) {
00047 }
00048
00049 inline
00050 Saturation_Matrix::Saturation_Matrix(const Saturation_Matrix& y)
00051 : rows(y.rows),
00052 row_size(y.row_size) {
00053 }
00054
00055 inline
00056 Saturation_Matrix::~Saturation_Matrix() {
00057 }
00058
00059 inline void
00060 Saturation_Matrix::rows_erase_to_end(const dimension_type first_to_erase) {
00061
00062
00063 assert(first_to_erase <= rows.size());
00064 if (first_to_erase < rows.size())
00065 rows.erase(rows.begin() + first_to_erase, rows.end());
00066 assert(OK());
00067 }
00068
00069 inline void
00070 Saturation_Matrix::columns_erase_to_end(const dimension_type first_to_erase) {
00071
00072
00073 assert(first_to_erase <= row_size);
00074 row_size = first_to_erase;
00075 assert(OK());
00076 }
00077
00078 inline void
00079 Saturation_Matrix::swap(Saturation_Matrix& y) {
00080 std::swap(row_size, y.row_size);
00081 std::swap(rows, y.rows);
00082 }
00083
00084 inline Saturation_Row&
00085 Saturation_Matrix::operator[](const dimension_type k) {
00086 assert(k < rows.size());
00087 return rows[k];
00088 }
00089
00090 inline const Saturation_Row&
00091 Saturation_Matrix::operator[](const dimension_type k) const {
00092 assert(k < rows.size());
00093 return rows[k];
00094 }
00095
00096 inline dimension_type
00097 Saturation_Matrix::num_columns() const {
00098 return row_size;
00099 }
00100
00101 inline dimension_type
00102 Saturation_Matrix::num_rows() const {
00103 return rows.size();
00104 }
00105
00106 inline void
00107 Saturation_Matrix::clear() {
00108
00109 std::vector<Saturation_Row>().swap(rows);
00110 row_size = 0;
00111 }
00112
00113 inline memory_size_type
00114 Saturation_Matrix::total_memory_in_bytes() const {
00115 return sizeof(*this) + external_memory_in_bytes();
00116 }
00117
00118 inline bool
00119 Saturation_Matrix::Saturation_Row_Less_Than::
00120 operator()(const Saturation_Row& x, const Saturation_Row& y) const {
00121 return compare(x, y) < 0;
00122 }
00123
00124 inline bool
00125 Saturation_Matrix::sorted_contains(const Saturation_Row& row) const {
00126 assert(check_sorted());
00127 return std::binary_search(rows.begin(), rows.end(), row,
00128 Saturation_Row_Less_Than());
00129 }
00130
00131 }
00132
00133
00134 namespace std {
00135
00137 inline void
00138 swap(Parma_Polyhedra_Library::Saturation_Matrix& x,
00139 Parma_Polyhedra_Library::Saturation_Matrix& y) {
00140 x.swap(y);
00141 }
00142
00143 }
00144
00145 #endif // !defined(PPL_Saturation_Matrix_inlines_hh)