All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Simplex_tree_node_explicit_storage.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) 2014 Inria
6 *
7 * Modification(s):
8 * - YYYY/MM Author: Description of the modification
9 */
10
11#ifndef SIMPLEX_TREE_SIMPLEX_TREE_NODE_EXPLICIT_STORAGE_H_
12#define SIMPLEX_TREE_SIMPLEX_TREE_NODE_EXPLICIT_STORAGE_H_
13
14// Empty base optimization for MSVC - https://learn.microsoft.com/en-us/cpp/cpp/empty-bases
15#if _MSC_VER
16 #define GUDHI_EMPTY_BASE_CLASS_OPTIMIZATION __declspec(empty_bases)
17#else
18 #define GUDHI_EMPTY_BASE_CLASS_OPTIMIZATION
19#endif
20
21#include <boost/core/empty_value.hpp>
22
23namespace Gudhi {
24
35template <class SimplexTree>
36struct GUDHI_EMPTY_BASE_CLASS_OPTIMIZATION Simplex_tree_node_explicit_storage
37 : SimplexTree::Filtration_simplex_base,
38 SimplexTree::Key_simplex_base,
39 SimplexTree::Hooks_simplex_base,
40 boost::empty_value<typename SimplexTree::Simplex_data> {
41 typedef typename SimplexTree::Siblings Siblings;
44 typedef typename SimplexTree::Simplex_data Simplex_data;
45
47 : SimplexTree::Filtration_simplex_base(filtration), children_(sib)
48 {}
49
50 //will fail to compile when called with SimplexTree::Options::store_key is false.
52 : SimplexTree::Filtration_simplex_base(filtration), SimplexTree::Key_simplex_base(key), children_(sib)
53 {}
54
55 /*
56 * Assign children to the node
57 */
58 void assign_children(Siblings * children) {
59 children_ = children;
60 }
61
62 /* Careful -> children_ can be NULL*/
63 Siblings * children() {
64 return children_;
65 }
66 const Siblings * children() const {
67 return children_;
68 }
69
70 Simplex_data& data() { return boost::empty_value<Simplex_data>::get(); }
71 const Simplex_data& data() const { return boost::empty_value<Simplex_data>::get(); }
72
73 private:
74 Siblings * children_;
75};
76 // end addtogroup simplex_tree
78
79} // namespace Gudhi
80
81#endif // SIMPLEX_TREE_SIMPLEX_TREE_NODE_EXPLICIT_STORAGE_H_
Get_simplex_data_type< Options >::type Simplex_data
Extra data stored in each simplex.
Definition: Simplex_tree.h:115
constexpr auto & get(Gudhi::persistence_matrix::Persistence_interval< Dimension, Event_value > &i) noexcept
Partial specialization of get for Gudhi::persistence_matrix::Persistence_interval.
Definition: persistence_interval.h:199
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14
Value type for a filtration function on a cell complex.
Definition: FiltrationValue.h:20
Node of a simplex tree with filtration value and simplex key.
Definition: Simplex_tree_node_explicit_storage.h:40
Key type used as simplex identifier.
Definition: SimplexKey.h:15