aGrUM
3.3.2
a C++ library for (probabilistic) graphical models
Toggle main menu visibility
leafPair_inl.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
#pragma once
42
43
#include <
agrum/FMDP/learning/datastructure/leaves/leafPair.h
>
44
45
namespace
gum
{
46
47
48
INLINE
LeafPair::LeafPair
(
AbstractLeaf
* l1,
AbstractLeaf
* l2) :
_l1_
(l1),
_l2_
(l2) {
49
GUM_CONSTRUCTOR(
LeafPair
);
50
}
51
52
INLINE
LeafPair::~LeafPair
() {
53
GUM_DESTRUCTOR(
LeafPair
);
54
;
55
}
56
57
INLINE
void
* LeafPair::operator
new
(
size_t
s) {
58
return
SmallObjectAllocator::instance
().
allocate
(s);
59
}
60
61
INLINE
void
LeafPair::operator
delete
(
void
* p) {
62
SmallObjectAllocator::instance
().
deallocate
(p,
sizeof
(
LeafPair
));
63
}
64
65
INLINE
AbstractLeaf
*
LeafPair::firstLeaf
() {
return
_l1_
; }
66
67
INLINE
AbstractLeaf
*
LeafPair::secondLeaf
() {
return
_l2_
; }
68
69
INLINE
bool
LeafPair::contains
(
NodeId
testedId) {
70
return
_l1_
->
contains
(testedId) ||
_l2_
->
contains
(testedId);
71
}
72
73
INLINE
AbstractLeaf
*
LeafPair::convert2Leaf
(
NodeId
leafId)
const
{
74
return
new
ComposedLeaf
(leafId,
_l1_
,
_l2_
);
75
}
76
77
INLINE
AbstractLeaf
*
LeafPair::otherLeaf
(
AbstractLeaf
* l)
const
{
78
return
l ==
_l1_
?
_l2_
:
_l1_
;
79
}
80
81
}
// namespace gum
gum::AbstractLeaf
<agrum/FMDP/learning/datastructure/leaves/abstractLeaf.h>
Definition
abstractLeaf.h:72
gum::AbstractLeaf::contains
virtual bool contains(NodeId testedId) const
Returns true if abstractleaf has leaf in it.
Definition
abstractLeaf_inl.h:65
gum::ComposedLeaf::ComposedLeaf
ComposedLeaf(NodeId leafId, AbstractLeaf *l1, AbstractLeaf *l2)
Default constructor.
Definition
composedLeaf_inl.h:48
gum::LeafPair::secondLeaf
AbstractLeaf * secondLeaf()
Definition
leafPair_inl.h:67
gum::LeafPair::LeafPair
LeafPair(AbstractLeaf *l1, AbstractLeaf *l2)
Default constructor.
Definition
leafPair_inl.h:48
gum::LeafPair::firstLeaf
AbstractLeaf * firstLeaf()
Definition
leafPair_inl.h:65
gum::LeafPair::contains
bool contains(NodeId testedId)
Returns true if pair has leaf in it.
Definition
leafPair_inl.h:69
gum::LeafPair::otherLeaf
AbstractLeaf * otherLeaf(AbstractLeaf *l) const
Definition
leafPair_inl.h:77
gum::LeafPair::_l1_
AbstractLeaf * _l1_
Definition
leafPair.h:134
gum::LeafPair::~LeafPair
~LeafPair()
Default destructor.
Definition
leafPair_inl.h:52
gum::LeafPair::_l2_
AbstractLeaf * _l2_
Definition
leafPair.h:135
gum::LeafPair::convert2Leaf
AbstractLeaf * convert2Leaf(NodeId leafId) const
Returns a leaf matching data and having given id as id.
Definition
leafPair_inl.h:73
gum::SmallObjectAllocator::instance
static SmallObjectAllocator & instance()
Definition
smallObjectAllocator_inl.h:96
gum::SmallObjectAllocator::allocate
void * allocate(const size_t &objectSize)
Allocates a block.
Definition
smallObjectAllocator.cpp:72
gum::SmallObjectAllocator::deallocate
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.
Definition
smallObjectAllocator_inl.h:116
gum::NodeId
Size NodeId
Type for node ids.
Definition
graphElements.h:117
leafPair.h
Headers of the leaf pair class.
gum
gum is the global namespace for all aGrUM entities
Definition
agrum.h:46
aGrUM
3.3.2
© PHW&CG&others - 2022
DoXyGeN 1.18.0