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 Inria
6 *
7 * Modification(s):
8 * - YYYY/MM Author: Description of the modification
9 */
10
17
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
32struct Dummy_dimension_holder {
33 Dummy_dimension_holder() = default;
34
35 template <typename Dimension>
36 Dummy_dimension_holder([[maybe_unused]] Dimension dim)
37 {}
38
39 friend void swap([[maybe_unused]] Dummy_dimension_holder& col1,
40 [[maybe_unused]] Dummy_dimension_holder& col2) noexcept
41 {}
42};
43
52template <class Master_matrix>
54 using Dimension = typename Master_matrix::Dimension;
55
61 : dim_(Master_matrix::Option_list::is_of_boundary_type ? 0 : Master_matrix::template get_null_value<Dimension>())
62 {}
63
70
77
84 : dim_(std::exchange(col.dim_, Master_matrix::template get_null_value<Dimension>()))
85 {}
86
87 ~Column_dimension_holder() = default;
88
94 Dimension get_dimension() const { return dim_; }
95
100
105 {
106 if (this == &other) return *this;
107
108 dim_ = std::exchange(other.dim_, Master_matrix::template get_null_value<Dimension>());
109 return *this;
110 }
111
115 friend void swap(Column_dimension_holder& col1, Column_dimension_holder& col2) noexcept
116 {
117 std::swap(col1.dim_, col2.dim_);
118 }
119
120 protected:
121 void _swap_dimension(Column_dimension_holder& other) { std::swap(dim_, other.dim_); }
122
123 private:
124 Dimension dim_;
125};
126
127} // namespace persistence_matrix
128} // namespace Gudhi
129
130#endif // PM_COLUMN_DIM_HOLDER_H
Persistence matrix namespace.
Definition FieldOperators.h:18
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14
Class managing the dimension access of a column.
Definition column_dimension_holder.h:53
Column_dimension_holder(Column_dimension_holder &&col) noexcept
Move constructor.
Definition column_dimension_holder.h:83
typename Master_matrix::Dimension Dimension
Definition column_dimension_holder.h:54
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:60
Column_dimension_holder(const Column_dimension_holder &col)=default
Copy constructor.
friend void swap(Column_dimension_holder &col1, Column_dimension_holder &col2) noexcept
Swap operator.
Definition column_dimension_holder.h:115
Dimension get_dimension() const
Returns the dimension of the column.
Definition column_dimension_holder.h:94
Column_dimension_holder & operator=(const Column_dimension_holder &other)=default
Assign operator.
Column_dimension_holder(Dimension dim)
Constructor setting the dimension to the given value.
Definition column_dimension_holder.h:69
Column_dimension_holder & operator=(Column_dimension_holder &&other) noexcept
Move assign operator.
Definition column_dimension_holder.h:104