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
18#ifndef PM_COLUMN_DIM_HOLDER_H
19#define PM_COLUMN_DIM_HOLDER_H
20
21#include <utility> //std::swap
22
23namespace Gudhi {
24namespace persistence_matrix {
25
33{
35 template <typename Dimension>
36 Dummy_dimension_holder([[maybe_unused]] Dimension dim) {}
37
38 friend void swap([[maybe_unused]] Dummy_dimension_holder& col1, [[maybe_unused]] Dummy_dimension_holder& col2) {}
39};
40
49template <class Master_matrix>
51{
52 using Dimension = typename Master_matrix::Dimension;
59 : dim_(Master_matrix::Option_list::is_of_boundary_type ? 0
60 : Master_matrix::template get_null_value<Dimension>()) {}
72 Column_dimension_holder(const Column_dimension_holder& col) : dim_(col.dim_) {}
79 : dim_(std::exchange(col.dim_, Master_matrix::template get_null_value<Dimension>())) {}
80
86 Dimension get_dimension() const { return dim_; }
87
92 dim_ = other.dim_;
93 return *this;
94 }
98 friend void swap(Column_dimension_holder& col1, Column_dimension_holder& col2) { std::swap(col1.dim_, col2.dim_); }
99
100 protected:
101 void swap_dimension(Column_dimension_holder& other) { std::swap(dim_, other.dim_); }
102
103 private:
104 Dimension dim_;
105};
106
107} // namespace persistence_matrix
108} // namespace Gudhi
109
110#endif // PM_COLUMN_DIM_HOLDER_H
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14
STL namespace.
Class managing the dimension access of a column.
Definition: column_dimension_holder.h:51
Column_dimension_holder & operator=(const Column_dimension_holder &other)
Assign operator.
Definition: column_dimension_holder.h:91
typename Master_matrix::Dimension Dimension
Definition: column_dimension_holder.h:52
friend void swap(Column_dimension_holder &col1, Column_dimension_holder &col2)
Swap operator.
Definition: column_dimension_holder.h:98
Column_dimension_holder(const Column_dimension_holder &col)
Copy constructor.
Definition: column_dimension_holder.h:72
Column_dimension_holder(Column_dimension_holder &&col)
Move constructor.
Definition: column_dimension_holder.h:78
Column_dimension_holder()
Default constructor. Sets the dimension to 0 for boundary matrices and to null index for chain matric...
Definition: column_dimension_holder.h:58
Dimension get_dimension() const
Returns the dimension of the column.
Definition: column_dimension_holder.h:86
Column_dimension_holder(Dimension dim)
Constructor setting the dimension to the given value.
Definition: column_dimension_holder.h:66
Empty structure. Inherited instead of Column_dimension_holder, when the columns are not storing a dim...
Definition: column_dimension_holder.h:33