aGrUM
0.20.2
a C++ library for (probabilistic) graphical models
edgeCode_inl.h
Go to the documentation of this file.
1
/**
2
*
3
* Copyright 2005-2020 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
,
35
NodeId
my_j
,
36
Size
my_l_i
,
37
Size
my_l_ij
,
38
Size
my_l_j
) :
39
i
(
my_i
),
40
j
(
my_j
),
l_i
(
my_l_i
),
l_ij
(
my_l_ij
),
l_j
(
my_l_j
) {
41
GUM_CONSTRUCTOR
(
EdgeCode
);
42
std
::
stringstream
sBuff
;
43
sBuff
<<
i
<<
j
<<
l_i
<<
l_ij
<<
l_j
;
44
name
=
sBuff
.
str
();
45
}
46
47
INLINE
48
EdgeCode
::
EdgeCode
(
const
EdgeCode
&
source
) :
49
i
(
source
.
i
),
j
(
source
.
j
),
l_i
(
source
.
l_i
),
l_ij
(
source
.
l_ij
),
50
l_j
(
source
.
l_j
),
name
(
source
.
name
) {
51
GUM_CONS_CPY
(
EdgeCode
);
52
}
53
54
INLINE
55
EdgeCode
::~
EdgeCode
() {
GUM_DESTRUCTOR
(
EdgeCode
); }
56
57
INLINE
58
bool
EdgeCode
::
isForward
()
const
{
return
i
<
j
; }
59
60
INLINE
61
bool
EdgeCode
::
isBackward
()
const
{
return
i
>
j
; }
62
63
INLINE
64
EdgeCode&
EdgeCode
::
operator
=(
const
EdgeCode
&
source
) {
65
i
=
source
.
i
;
66
j
=
source
.
j
;
67
l_i
=
source
.
l_i
;
68
l_ij
=
source
.
l_ij
;
69
l_j
=
source
.
l_j
;
70
return
*
this
;
71
}
72
73
INLINE
74
bool
EdgeCode
::
operator
==(
const
EdgeCode
&
code
)
const
{
75
return
((
i
==
code
.
i
) && (
j
==
code
.
j
) && (
l_i
==
code
.
l_i
)
76
&& (
l_ij
==
code
.
l_ij
) && (
l_j
==
code
.
l_j
));
77
}
78
79
INLINE
80
bool
EdgeCode
::
operator
!=(
const
EdgeCode
&
code
)
const
{
81
return
((
i
!=
code
.
i
) || (
j
!=
code
.
j
) || (
l_i
!=
code
.
l_i
)
82
|| (
l_ij
!=
code
.
l_ij
) || (
l_j
!=
code
.
l_j
));
83
}
84
85
INLINE
86
bool
EdgeCode
::
operator
<(
const
EdgeCode
&
code
)
const
{
87
if
((
i
==
code
.
i
) && (
j
==
code
.
j
)) {
88
return
(
l_i
<
code
.
l_i
) || ((
l_i
==
code
.
l_i
) && (
l_ij
<
code
.
l_ij
))
89
|| ((
l_i
==
code
.
l_i
) && (
l_ij
==
code
.
l_ij
) && (
l_j
<
code
.
l_j
));
90
}
else
{
91
return
((
i
==
code
.
i
) && (
j
<
code
.
j
))
92
|| ((
i
<
code
.
j
) && (
j
==
code
.
i
));
93
}
94
}
95
96
}
// namespace gspan
97
}
// namespace prm
98
}
// namespace gum
gum::Set::emplace
INLINE void emplace(Args &&... args)
Definition:
set_tpl.h:669
gum::prm::ParamScopeData::ParamScopeData
ParamScopeData(const std::string &s, const PRMReferenceSlot< GUM_SCALAR > &ref, Idx d)
Definition:
PRMClass_tpl.h:1101
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:393