Loading...
Searching...
No Matches
column_dimension_holder.h
Go to the documentation of this file.
1/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
2 * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
3 * Author(s): Hannah Schreiber
4 *
5 * Copyright (C) 2022-24 Inria
6 *
7 * Modification(s):
8 * - YYYY/MM Author: Description of the modification
9 */
10
17#ifndef PM_COLUMN_DIM_HOLDER_H
18#define PM_COLUMN_DIM_HOLDER_H
19
20#include <utility> //std::swap
21
22namespace Gudhi {
23namespace persistence_matrix {
24
32{
34 template <typename dimension_type>
35 Dummy_dimension_holder([[maybe_unused]] dimension_type dim) {}
36
37 friend void swap([[maybe_unused]] Dummy_dimension_holder& col1, [[maybe_unused]] Dummy_dimension_holder& col2) {}
38};
39
48template <class Master_matrix>
50{
51 using dimension_type = typename Master_matrix::dimension_type;
56 Column_dimension_holder() : dim_(Master_matrix::Option_list::is_of_boundary_type ? 0 : -1) {}
68 Column_dimension_holder(const Column_dimension_holder& col) : dim_(col.dim_) {}
74 Column_dimension_holder(Column_dimension_holder&& col) : dim_(std::exchange(col.dim_, -1)) {}
75
81 dimension_type get_dimension() const { return dim_; }
82
87 dim_ = other.dim_;
88 return *this;
89 }
93 friend void swap(Column_dimension_holder& col1, Column_dimension_holder& col2) { std::swap(col1.dim_, col2.dim_); }
94
95 protected:
96 void swap_dimension(Column_dimension_holder& other) { std::swap(dim_, other.dim_); }
97
98 private:
99 dimension_type dim_;
100};
101
102} // namespace persistence_matrix
103} // namespace Gudhi
104
105#endif // PM_COLUMN_DIM_HOLDER_H
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14
Class managing the dimension access of a column.
Definition column_dimension_holder.h:50
Column_dimension_holder & operator=(const Column_dimension_holder &other)
Assign operator.
Definition column_dimension_holder.h:86
dimension_type get_dimension() const
Returns the dimension of the column.
Definition column_dimension_holder.h:81
friend void swap(Column_dimension_holder &col1, Column_dimension_holder &col2)
Swap operator.
Definition column_dimension_holder.h:93
Column_dimension_holder(const Column_dimension_holder &col)
Copy constructor.
Definition column_dimension_holder.h:68
Column_dimension_holder(Column_dimension_holder &&col)
Move constructor.
Definition column_dimension_holder.h:74
Column_dimension_holder()
Default constructor. Sets the dimension to 0 for boundary matrices and to -1 for chain matrices.
Definition column_dimension_holder.h:56
Column_dimension_holder(dimension_type dim)
Constructor setting the dimension to the given value.
Definition column_dimension_holder.h:62
typename Master_matrix::dimension_type dimension_type
Definition column_dimension_holder.h:51
Empty structure. Inheritated instead of Column_dimension_holder, when the columns are not storing a d...
Definition column_dimension_holder.h:32