aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
edgeCode_inl.h
Go to the documentation of this file.
1
/**
2
*
3
* Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4
* info_at_agrum_dot_org
5
*
6
* This library is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with this library. If not, see <http://www.gnu.org/licenses/>.
18
*
19
*/
20
21
22
/**
23
* @file
24
* @brief Inline implementation of the EdgeCode class.
25
*
26
* @author Lionel TORTI and Pierre-Henri WUILLEMIN(@LIP6)
27
*/
28
29
namespace
gum
{
30
namespace
prm
{
31
namespace
gspan
{
32
33
INLINE
34
EdgeCode
::
EdgeCode
(
NodeId
my_i
,
NodeId
my_j
,
Size
my_l_i
,
Size
my_l_ij
,
Size
my_l_j
) :
35
i
(
my_i
),
j
(
my_j
),
l_i
(
my_l_i
),
l_ij
(
my_l_ij
),
l_j
(
my_l_j
) {
36
GUM_CONSTRUCTOR
(
EdgeCode
);
37
std
::
stringstream
sBuff
;
38
sBuff
<<
i
<<
j
<<
l_i
<<
l_ij
<<
l_j
;
39
name
=
sBuff
.
str
();
40
}
41
42
INLINE
43
EdgeCode
::
EdgeCode
(
const
EdgeCode
&
source
) :
44
i
(
source
.
i
),
j
(
source
.
j
),
l_i
(
source
.
l_i
),
l_ij
(
source
.
l_ij
),
l_j
(
source
.
l_j
),
45
name
(
source
.
name
) {
46
GUM_CONS_CPY
(
EdgeCode
);
47
}
48
49
INLINE
EdgeCode
::~
EdgeCode
() {
50
GUM_DESTRUCTOR
(
EdgeCode
);
51
;
52
}
53
54
INLINE
55
bool
EdgeCode
::
isForward
()
const
{
return
i
<
j
; }
56
57
INLINE
58
bool
EdgeCode
::
isBackward
()
const
{
return
i
>
j
; }
59
60
INLINE
61
EdgeCode&
EdgeCode
::
operator
=(
const
EdgeCode
&
source
) {
62
i
=
source
.
i
;
63
j
=
source
.
j
;
64
l_i
=
source
.
l_i
;
65
l_ij
=
source
.
l_ij
;
66
l_j
=
source
.
l_j
;
67
return
*
this
;
68
}
69
70
INLINE
71
bool
EdgeCode
::
operator
==(
const
EdgeCode
&
code
)
const
{
72
return
((
i
==
code
.
i
) && (
j
==
code
.
j
) && (
l_i
==
code
.
l_i
) && (
l_ij
==
code
.
l_ij
)
73
&& (
l_j
==
code
.
l_j
));
74
}
75
76
INLINE
77
bool
EdgeCode
::
operator
!=(
const
EdgeCode
&
code
)
const
{
78
return
((
i
!=
code
.
i
) || (
j
!=
code
.
j
) || (
l_i
!=
code
.
l_i
) || (
l_ij
!=
code
.
l_ij
)
79
|| (
l_j
!=
code
.
l_j
));
80
}
81
82
INLINE
83
bool
EdgeCode
::
operator
<(
const
EdgeCode
&
code
)
const
{
84
if
((
i
==
code
.
i
) && (
j
==
code
.
j
)) {
85
return
(
l_i
<
code
.
l_i
) || ((
l_i
==
code
.
l_i
) && (
l_ij
<
code
.
l_ij
))
86
|| ((
l_i
==
code
.
l_i
) && (
l_ij
==
code
.
l_ij
) && (
l_j
<
code
.
l_j
));
87
}
else
{
88
return
((
i
==
code
.
i
) && (
j
<
code
.
j
)) || ((
i
<
code
.
j
) && (
j
==
code
.
i
));
89
}
90
}
91
92
}
// namespace gspan
93
}
// namespace prm
94
}
// namespace gum
gum::Set::emplace
INLINE void emplace(Args &&... args)
Definition:
set_tpl.h:643
gum::prm::ParamScopeData::ParamScopeData
ParamScopeData(const std::string &s, const PRMReferenceSlot< GUM_SCALAR > &ref, Idx d)
Definition:
PRMClass_tpl.h:1032
gum::prm::gspan::operator<<
INLINE std::ostream & operator<<(std::ostream &out, const EdgeData< GUM_SCALAR > &data)
Print a EdgeData<GUM_SCALAR> in out.
Definition:
interfaceGraph_tpl.h:370