17 #ifndef PM_ROW_ACCESS_H
18 #define PM_ROW_ACCESS_H
23 namespace persistence_matrix {
36 template <
typename index,
class Row_container_type>
37 Dummy_row_access([[maybe_unused]] index columnIndex, [[maybe_unused]] Row_container_type& rows) {}
48 template <
class Master_matrix>
52 using index =
typename Master_matrix::index;
53 using id_index =
typename Master_matrix::id_index;
54 using Cell_type =
typename Master_matrix::Cell_type;
110 std::swap(r1.rows_, r2.rows_);
111 std::swap(r1.columnIndex_, r2.columnIndex_);
121 using base_hook_matrix_row =
typename Master_matrix::base_hook_matrix_row;
124 template <
class Master_matrix>
128 template <
class Master_matrix>
130 : columnIndex_(columnIndex), rows_(rows)
133 template <
class Master_matrix>
135 : columnIndex_(std::exchange(other.columnIndex_, 0)), rows_(other.rows_)
138 template <
class Master_matrix>
141 if (rows_ ==
nullptr)
return;
143 if constexpr (!Master_matrix::Option_list::has_removable_rows) {
144 if (rows_->size() < rowIndex + 1) rows_->resize(rowIndex + 1);
148 if constexpr (Master_matrix::Option_list::has_intrusive_rows) {
149 rows_->operator[](rowIndex).push_back(*cell);
151 rows_->operator[](rowIndex).insert(*cell);
155 template <
class Master_matrix>
158 if (rows_ ==
nullptr)
return;
160 if constexpr (Master_matrix::Option_list::has_intrusive_rows) {
161 cell->base_hook_matrix_row::unlink();
163 if constexpr (Master_matrix::Option_list::has_removable_rows) {
164 auto it = rows_->find(cell->get_row_index());
165 it->second.erase(*cell);
167 rows_->operator[](cell->get_row_index()).erase(*cell);
172 template <
class Master_matrix>
175 if constexpr (!Master_matrix::Option_list::has_intrusive_rows) {
176 if (rows_ ==
nullptr)
return;
177 auto& row = rows_->at(cell.get_row_index());
178 auto it = row.find(cell);
180 row.insert(it, cell);
184 template <
class Master_matrix>
Class managing the row access for the columns.
Definition: row_access.h:50
void unlink(Cell_type *cell)
Removes the given cell from its row.
Definition: row_access.h:156
typename Master_matrix::index index
Definition: row_access.h:52
typename Master_matrix::id_index id_index
Definition: row_access.h:53
Row_access()
Default constructor. Sets the column index to -1 and the row container to nullptr....
Definition: row_access.h:125
typename Master_matrix::Cell_type Cell_type
Definition: row_access.h:54
typename Master_matrix::row_container_type Row_container_type
Definition: row_access.h:55
index get_column_index() const
Returns the MatIdx column index.
Definition: row_access.h:185
void update_cell(const Cell_type &cell)
If PersistenceMatrixOptions::has_intrusive_rows is false, updates the copy of the cell in its row....
Definition: row_access.h:173
friend void swap(Row_access &r1, Row_access &r2)
Swap operator.
Definition: row_access.h:109
void insert_cell(id_index rowIndex, Cell_type *cell)
Inserts the given cell at the given row index.
Definition: row_access.h:139
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14
Empty structure. Inheritated instead of Row_access, if the row access is not enabled.
Definition: row_access.h:32