aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
IDWriter.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 Head of abstract classe for export of influence diagram
25
*
26
* All classes used to export ID must inherit from IDWriter
27
*
28
* @author Pierre-Henri WUILLEMIN(@LIP6) and Jean-Christophe MAGNAN and Christophe
29
* GONZALES(@AMU)
30
*/
31
#
ifndef
GUM_ID_WRITER_H
32
#
define
GUM_ID_WRITER_H
33
34
#
include
<
agrum
/
ID
/
influenceDiagram
.
h
>
35
#
include
<
agrum
/
agrum
.
h
>
36
#
include
<
iostream
>
37
#
include
<
string
>
38
39
namespace
gum {
40
41
/**
42
* @class IDWriter
43
* @brief Pure virtual class for exporting an ID.
44
* @ingroup id_group
45
*
46
* All classes used to write an influence diagram in a stream or
47
* a file must inherit from this class
48
*/
49
template
<
typename
GUM_SCALAR >
50
51
class
IDWriter {
52
public
:
53
/**
54
* Default constructor.
55
*/
56
IDWriter();
57
58
/**
59
* Default destructor.
60
*/
61
virtual
~IDWriter();
62
63
/**
64
* Writes an influence diagram in the given ouput stream.
65
*
66
* @param output The output stream.
67
* @param infdiag The influence diagram writen in the stream.
68
* @throws IOError Raised if an I/O error occurs.
69
*/
70
virtual
void
write(std::ostream& output,
const
InfluenceDiagram< GUM_SCALAR >& infdiag) = 0;
71
72
/**
73
* Writes an Influence Diagram in the file referenced by filePath.
74
* If the file doesn't exists, it is created.
75
* If the file exists, it's content will be erased.
76
*
77
* @param filePath The path to the file used to write the Influence Diagram.
78
* @param infdiag The Influence Diagram writen in the file.
79
* @throw IOError Raised if an I/O error occurs.
80
*/
81
virtual
void
write(std::string filePath,
const
InfluenceDiagram< GUM_SCALAR >& infdiag) = 0;
82
};
83
}
/* namespace gum */
84
85
#
include
"IDWriter_tpl.h"
86
87
#
endif
// GUM_ID_WRITER_H