aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
errorsContainer_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
/** @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
,
Idx
line
,
Idx
col
,
const
wchar_t
*
msg
) {
35
add
(
ParseError
(
true
,
narrow
(
std
::
wstring
(
msg
)),
narrow
(
filename
),
line
,
col
));
36
}
37
38
INLINE
39
void
40
ErrorsContainer
::
Warning
(
const
std
::
wstring
&
filename
,
Idx
line
,
Idx
col
,
const
wchar_t
*
msg
) {
41
add
(
ParseError
(
false
,
narrow
(
std
::
wstring
(
msg
)),
narrow
(
filename
),
line
,
col
));
42
}
43
44
INLINE
45
void
ErrorsContainer
::
Exception
(
const
std
::
wstring
&
filename
,
const
wchar_t
*
msg
) {
46
add
(
ParseError
(
true
,
"Exception : "
+
narrow
(
std
::
wstring
(
msg
)),
narrow
(
filename
), 0, 0));
47
}
48
49
INLINE
50
void
ErrorsContainer
::
add
(
ParseError
error
) {
51
errors
.
push_back
(
error
);
52
53
if
(
error
.
is_error
)
54
error_count
++;
55
else
56
warning_count
++;
57
}
58
59
INLINE
60
void
ErrorsContainer
::
addError
(
const
std
::
string
&
msg
,
61
const
std
::
string
&
filename
,
62
Idx
line
,
63
Idx
col
) {
64
add
(
ParseError
(
true
,
msg
,
filename
,
line
,
col
));
65
}
66
67
INLINE
68
void
ErrorsContainer
::
addWarning
(
const
std
::
string
&
msg
,
69
const
std
::
string
&
filename
,
70
Idx
line
,
71
Idx
col
) {
72
add
(
ParseError
(
false
,
msg
,
filename
,
line
,
col
));
73
}
74
75
INLINE
76
void
ErrorsContainer
::
addException
(
const
std
::
string
&
msg
,
const
std
::
string
&
filename
) {
77
add
(
ParseError
(
true
,
msg
,
filename
, 0, 0));
78
}
79
80
INLINE
81
Size
ErrorsContainer
::
count
()
const
{
return
error_count
+
warning_count
; }
82
83
INLINE
84
void
ErrorsContainer
::
syntheticResults
(
std
::
ostream
&
o
)
const
{
85
o
<<
"Errors : "
<<
error_count
<<
std
::
endl
;
86
o
<<
"Warnings : "
<<
warning_count
<<
std
::
endl
;
87
}
88
89
}
// namespace gum
gum::Set::emplace
INLINE void emplace(Args &&... args)
Definition:
set_tpl.h:643