aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
link.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2025 by *
5 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
6 * - Christophe GONZALES(_at_AMU) *
7 * *
8 * The aGrUM/pyAgrum library is free software; you can redistribute it *
9 * and/or modify it under the terms of either : *
10 * *
11 * - the GNU Lesser General Public License as published by *
12 * the Free Software Foundation, either version 3 of the License, *
13 * or (at your option) any later version, *
14 * - the MIT license (MIT), *
15 * - or both in dual license, as here. *
16 * *
17 * (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18 * *
19 * This aGrUM/pyAgrum library is distributed in the hope that it will be *
20 * useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26 * OTHER DEALINGS IN THE SOFTWARE. *
27 * *
28 * See LICENCES for more details. *
29 * *
30 * SPDX-FileCopyrightText: Copyright 2005-2025 *
31 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
32 * - Christophe GONZALES(_at_AMU) *
33 * SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34 * *
35 * Contact : info_at_agrum_dot_org *
36 * homepage : http://agrum.gitlab.io *
37 * gitlab : https://gitlab.com/agrumery/agrum *
38 * *
39 ****************************************************************************/
40
41
50#ifndef GUM_MULTI_DIM_FUNCTION_GRAPH_LINK_H
51#define GUM_MULTI_DIM_FUNCTION_GRAPH_LINK_H
52
53// ============================================================================
54#include <agrum/agrum.h>
55// ============================================================================
57
58// ============================================================================
59
60namespace gum {
61
71 template < typename T >
72 class Link {
73 public:
74 // ============================================================================
76 // ============================================================================
78
82 explicit Link(const T& elem);
83
87 Link(const T& elem, Link< T >* nextLink);
88
92 ~Link();
93
97 void* operator new(size_t s);
98
102 void operator delete(void* p);
103
105 // ============================================================================
107 // ============================================================================
109
113 const T& element() const;
114
118 T& element();
119
123 const Link< T >* nextLink() const;
124
129
133 void setNextLink(Link< T >* newLink);
134
136
137 private:
140
143 };
144
154 template < typename T >
156 public:
157 // ============================================================================
159 // ============================================================================
161
162 // ============================================================================
164 // ============================================================================
165 LinkedList();
166
167 // ============================================================================
169 // ============================================================================
170 ~LinkedList();
171
172 // ============================================================================
174 // ============================================================================
175 void* operator new(size_t s);
176
177 // ============================================================================
179 // ============================================================================
180 void operator delete(void* p);
181
183 // ============================================================================
185 // ============================================================================
187
191 const Link< T >* list() const;
192
196 Link< T >* list();
197
201 void clear();
202
206 void addLink(const T& elem);
207
211 void searchAndRemoveLink(const T& elem);
212
214
215 private:
218 };
219
220#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
221 extern template class Link< Idx >;
222#endif
223
224} // End of namespace gum
225
227
228#endif /* GUM_MULTI_DIM_FUNCTION_GRAPH_LINK_H */
~LinkedList()
Destructor.
Definition link_tpl.h:120
void searchAndRemoveLink(const T &elem)
Removes a element from the list.
Definition link_tpl.h:163
void clear()
Clears the list.
Definition link_tpl.h:146
const Link< T > * list() const
Returns the first link in the chained list.
Definition link_tpl.h:136
Link< T > * _firstLink_
The first link of our list.
Definition link.h:217
LinkedList()
Constructor.
Definition link_tpl.h:113
void addLink(const T &elem)
Adds a link.
Definition link_tpl.h:157
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
Headers of gum::SmallObjectAllocator.