aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
BNReader.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 Definition of abstract classes for file input manipulation
25
* of Bayesian networks.
26
*
27
* Every classe used to read a BN from a file, must inherit from
28
* BNWriter or BNReader.
29
*
30
* @author Lionel TORTI and Pierre-Henri WUILLEMIN(@LIP6)
31
*/
32
#
ifndef
GUM_BN_READER_H
33
#
define
GUM_BN_READER_H
34
35
#
include
<
agrum
/
BN
/
BayesNet
.
h
>
36
#
include
<
agrum
/
agrum
.
h
>
37
#
include
<
iostream
>
38
#
include
<
string
>
39
40
namespace
gum {
41
/* =========================================================================*/
42
/* === READERS === */
43
/* =========================================================================*/
44
/**
45
* @class BNReader
46
* @headerfile BNReader.h <agrum/BN/io/BNReader.h>
47
* @ingroup bn_io
48
* @brief Pure virtual class for reading a BN from a file.
49
*
50
* Every class used to read the content of a Bayesian network from a stream,
51
* or a file must be a subclass of BNReader.
52
*/
53
template
<
typename
GUM_SCALAR >
54
class
BNReader {
55
public
:
56
/**
57
* Constructor
58
* A reader is defined for reading a defined file. Hence the 2 args of the
59
* constructor.
60
* Note that the BN has to be built outside the reader. There is no
61
* delegation to create/destroy the BN from inside the reader.
62
*/
63
BNReader(BayesNet< GUM_SCALAR >* bn,
const
std::string& filename);
64
65
/**
66
* Default destructor.
67
*/
68
virtual
~BNReader();
69
70
/**
71
* Reads a Bayesian network from the file referenced by filePath into`
72
* parameter bayesNet.
73
* @return Returns the number of error during the parsing (0 if none).
74
*/
75
virtual
Size proceed() = 0;
76
};
77
78
79
#
ifndef
GUM_NO_EXTERN_TEMPLATE_CLASS
80
extern
template
class
BNReader<
double
>;
81
#
endif
82
83
}
/* namespace gum */
84
85
#
include
<
agrum
/
BN
/
io
/
BNReader_tpl
.
h
>
86
87
#
endif
// GUM_BN_READER_H