aGrUM
0.20.2
a C++ library for (probabilistic) graphical models
errorsContainer_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
/** @file
23
* @brief Inlined implementation of the basic methods of ErrorsContainer
24
*
25
* @author Pierre-Henri WUILLEMIN(@LIP6)
26
*/
27
28
// to ease automatic parsers
29
#
include
<
agrum
/
tools
/
core
/
errorsContainer
.
h
>
30
31
namespace
gum
{
32
33
INLINE
34
void
ErrorsContainer
::
Error
(
const
std
::
wstring
&
filename
,
35
Idx
line
,
36
Idx
col
,
37
const
wchar_t
*
msg
) {
38
add
(
ParseError
(
true
,
narrow
(
std
::
wstring
(
msg
)),
narrow
(
filename
),
line
,
col
));
39
}
40
41
INLINE
42
void
ErrorsContainer
::
Warning
(
const
std
::
wstring
&
filename
,
43
Idx
line
,
44
Idx
col
,
45
const
wchar_t
*
msg
) {
46
add
(
ParseError
(
false
,
narrow
(
std
::
wstring
(
msg
)),
narrow
(
filename
),
line
,
col
));
47
}
48
49
INLINE
50
void
ErrorsContainer
::
Exception
(
const
std
::
wstring
&
filename
,
51
const
wchar_t
*
msg
) {
52
add
(
ParseError
(
true
,
53
"Exception : "
+
narrow
(
std
::
wstring
(
msg
)),
54
narrow
(
filename
),
55
0,
56
0));
57
}
58
59
INLINE
60
void
ErrorsContainer
::
add
(
ParseError
error
) {
61
errors
.
push_back
(
error
);
62
63
if
(
error
.
is_error
)
64
error_count
++;
65
else
66
warning_count
++;
67
}
68
69
INLINE
70
void
ErrorsContainer
::
addError
(
const
std
::
string
&
msg
,
71
const
std
::
string
&
filename
,
72
Idx
line
,
73
Idx
col
) {
74
add
(
ParseError
(
true
,
msg
,
filename
,
line
,
col
));
75
}
76
77
INLINE
78
void
ErrorsContainer
::
addWarning
(
const
std
::
string
&
msg
,
79
const
std
::
string
&
filename
,
80
Idx
line
,
81
Idx
col
) {
82
add
(
ParseError
(
false
,
msg
,
filename
,
line
,
col
));
83
}
84
85
INLINE
86
void
ErrorsContainer
::
addException
(
const
std
::
string
&
msg
,
87
const
std
::
string
&
filename
) {
88
add
(
ParseError
(
true
,
msg
,
filename
, 0, 0));
89
}
90
91
INLINE
92
Size
ErrorsContainer
::
count
()
const
{
return
error_count
+
warning_count
; }
93
94
INLINE
95
void
ErrorsContainer
::
syntheticResults
(
std
::
ostream
&
o
)
const
{
96
o
<<
"Errors : "
<<
error_count
<<
std
::
endl
;
97
o
<<
"Warnings : "
<<
warning_count
<<
std
::
endl
;
98
}
99
100
}
// namespace gum
gum::Set::emplace
INLINE void emplace(Args &&... args)
Definition:
set_tpl.h:669