hooks_simplex_base.h
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): ClĂ©ment Maria
4  *
5  * Copyright (C) 2020 Inria
6  *
7  * Modification(s):
8  * - YYYY/MM Author: Description of the modification
9  */
10 
11 #ifndef SIMPLEX_TREE_HOOKS_SIMPLEX_BASE_H_
12 #define SIMPLEX_TREE_HOOKS_SIMPLEX_BASE_H_
13 
14 #include <boost/intrusive/list.hpp>
15 #include <stdexcept>
16 
17 namespace Gudhi {
21 
30  public:
32  // The following 2 functions are conceptually wrong, but when copying a Simplex_tree it is more convenient to have
33  // them (and fix things asap after they are called).
34  // copy constructor, inherited by the Node class, requires to copy hooks
36  : list_max_vertex_hook_() { }
37  // copy assignment
39  throw std::logic_error("Should not happen");
40  }
41  // move constructor
43  list_max_vertex_hook_.swap_nodes(other.list_max_vertex_hook_);
44  }
45  // move assignment
47  list_max_vertex_hook_.swap_nodes(other.list_max_vertex_hook_);
48  return *this;
49  }
50  void unlink_hooks() { list_max_vertex_hook_.unlink(); }
51  ~Hooks_simplex_base_link_nodes() {} // unlink_hooks(); }
52 
53  typedef boost::intrusive::list_member_hook< // allows .unlink()
54  boost::intrusive::link_mode<boost::intrusive::auto_unlink>>
55  Member_hook_t;
56 
57  Member_hook_t list_max_vertex_hook_;
58  };
59 
60 } // namespace Gudhi
61 
62 #endif // SIMPLEX_TREE_HOOKS_SIMPLEX_BASE_H_
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14
No hook when SimplexTreeOptions::link_nodes_by_label is false.
Definition: hooks_simplex_base.h:20