aGrUM
3.2.0
a C++ library for (probabilistic) graphical models
Toggle main menu visibility
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-2026 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-2026 *
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
// ============================================================================
56
#include <
agrum/base/core/smallobjectallocator/smallObjectAllocator.h
>
57
58
// ============================================================================
59
60
namespace
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
128
Link< T >
*
nextLink
();
129
133
void
setNextLink
(
Link< T >
* newLink);
134
136
137
private
:
139
T
_element_
;
140
142
Link< T >
*
_nextLink_
;
143
};
144
154
template
<
typename
T >
155
class
LinkedList
{
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
:
217
Link< T >
*
_firstLink_
;
218
};
219
220
#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
221
extern
template
class
GUM_SHARED_PUBLIC
Link< Idx >
;
222
#endif
223
224
}
// End of namespace gum
225
226
#include <
agrum/base/multidim/utils/FunctionGraphUtilities/link_tpl.h
>
227
228
#endif
/* GUM_MULTI_DIM_FUNCTION_GRAPH_LINK_H */
agrum.h
gum::Link
Link of a chain list allocated using the SmallObjectAllocator.
Definition
link.h:72
gum::Link::_nextLink_
Link< T > * _nextLink_
The next link in the list.
Definition
link.h:142
gum::Link::element
const T & element() const
Returns the element stored in this link.
Definition
link_tpl.h:87
gum::Link::setNextLink
void setNextLink(Link< T > *newLink)
Sets the next link.
Definition
link_tpl.h:107
gum::Link::_element_
T _element_
The element embedded in this link.
Definition
link.h:139
gum::Link::nextLink
const Link< T > * nextLink() const
Returns next link.
Definition
link_tpl.h:97
gum::Link::Link
Link(const T &elem)
Constructor.
Definition
link_tpl.h:60
gum::LinkedList::addLink
void addLink(const T &elem)
Adds a link.
Definition
link_tpl.h:157
gum::LinkedList::list
const Link< T > * list() const
Returns the first link in the chained list.
Definition
link_tpl.h:136
gum::LinkedList::LinkedList
LinkedList()
Constructor.
Definition
link_tpl.h:113
gum::LinkedList::clear
void clear()
Clears the list.
Definition
link_tpl.h:146
gum::LinkedList::_firstLink_
Link< T > * _firstLink_
The first link of our list.
Definition
link.h:217
gum::LinkedList::searchAndRemoveLink
void searchAndRemoveLink(const T &elem)
Removes a element from the list.
Definition
link_tpl.h:163
link_tpl.h
Template methods of MultiDimFunctionGraph.
gum
gum is the global namespace for all aGrUM entities
Definition
agrum.h:46
gum::Link< Idx >
template class GUM_SHARED_PUBLIC Link< Idx >
Definition
link.cpp:55
smallObjectAllocator.h
Headers of gum::SmallObjectAllocator.
aGrUM
3.2.0
© PHW&CG&others - 2022
DoXyGeN 1.18.0