aGrUM
3.2.0
a C++ library for (probabilistic) graphical models
Toggle main menu visibility
O3prmBNWriter.h
Go to the documentation of this file.
1
/****************************************************************************
2
* This file is part of the aGrUM/pyAgrum library. *
3
* *
4
* Copyright (c) 2005-2026 by *
5
* - Pierre-Henri WUILLEMIN(_at_LIP6) *
6
* - Christophe GONZALES(_at_AMU) *
7
* *
8
* The aGrUM/pyAgrum library is free software; you can redistribute it *
9
* and/or modify it under the terms of either : *
10
* *
11
* - the GNU Lesser General Public License as published by *
12
* the Free Software Foundation, either version 3 of the License, *
13
* or (at your option) any later version, *
14
* - the MIT license (MIT), *
15
* - or both in dual license, as here. *
16
* *
17
* (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18
* *
19
* This aGrUM/pyAgrum library is distributed in the hope that it will be *
20
* useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26
* OTHER DEALINGS IN THE SOFTWARE. *
27
* *
28
* See LICENCES for more details. *
29
* *
30
* SPDX-FileCopyrightText: Copyright 2005-2026 *
31
* - Pierre-Henri WUILLEMIN(_at_LIP6) *
32
* - Christophe GONZALES(_at_AMU) *
33
* SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34
* *
35
* Contact : info_at_agrum_dot_org *
36
* homepage : http://agrum.gitlab.io *
37
* gitlab : https://gitlab.com/agrumery/agrum *
38
* *
39
****************************************************************************/
40
41
51
52
#ifndef GUM_O3PRMBNWRITER_H
53
#define GUM_O3PRMBNWRITER_H
54
55
56
#include <fstream>
57
#include <iostream>
58
#include <sstream>
59
#include <string>
60
61
#include <
agrum/agrum.h
>
62
63
#include <
agrum/base/variables/allDiscreteVariables.h
>
64
#include <
agrum/BN/io/BNWriter.h
>
65
66
namespace
gum
{
76
template
< GUM_Numeric GUM_SCALAR >
77
class
O3prmBNWriter
:
public
BNWriter
< GUM_SCALAR > {
78
public
:
79
// ==========================================================================
81
// ==========================================================================
83
87
O3prmBNWriter
();
88
92
~O3prmBNWriter
()
override
;
93
95
96
protected
:
104
void
_doWrite
(std::ostream& output,
const
IBayesNet< GUM_SCALAR >
& bn)
final
;
105
115
void
_doWrite
(std::string_view filePath,
const
IBayesNet< GUM_SCALAR >
& bn)
final
;
116
117
private
:
118
std::string
_extractAttribute_
(
const
IBayesNet< GUM_SCALAR >
& bn,
NodeId
node);
119
120
std::string
_extractType_
(
const
IBayesNet< GUM_SCALAR >
& bn,
NodeId
node);
121
122
template
<
typename
VARTYPE >
123
std::string
_extractDiscretizedType_
(
const
VARTYPE* var);
124
125
std::string
_extractName_
(
const
IBayesNet< GUM_SCALAR >
& bn,
NodeId
node);
126
127
std::string
_extractParents_
(
const
IBayesNet< GUM_SCALAR >
& bn,
NodeId
node);
128
129
std::string
_extractCPT_
(
const
IBayesNet< GUM_SCALAR >
& bn,
NodeId
node);
130
131
std::string
_extractRangeType_
(
const
IBayesNet< GUM_SCALAR >
& bn,
NodeId
node);
132
133
std::string
_extractLabelizedType_
(
const
IBayesNet< GUM_SCALAR >
& bn,
NodeId
node);
134
};
135
136
137
#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
138
extern
template
class
O3prmBNWriter< double >
;
139
#endif
140
141
}
/* namespace gum */
142
143
#include <
agrum/PRM/o3prm/O3prmBNWriter_tpl.h
>
144
145
#endif
// GUM_O3PRMBNWRITER_H
BNWriter.h
Definition of abstract classes for file output manipulation of Bayesian networks.
O3prmBNWriter_tpl.h
agrum.h
allDiscreteVariables.h
gum::BNWriter::BNWriter
BNWriter()
Default constructor.
gum::IBayesNet
Class representing the minimal interface for Bayesian network with no numerical data.
Definition
IBayesNet.h:75
gum::O3prmBNWriter
<agrum/PRM/o3prm/O3prmBNWriter.h>
Definition
O3prmBNWriter.h:77
gum::O3prmBNWriter::_extractRangeType_
std::string _extractRangeType_(const IBayesNet< GUM_SCALAR > &bn, NodeId node)
gum::O3prmBNWriter::_doWrite
void _doWrite(std::ostream &output, const IBayesNet< GUM_SCALAR > &bn) final
Writes a Bayes net in the given output stream.
gum::O3prmBNWriter::_extractDiscretizedType_
std::string _extractDiscretizedType_(const VARTYPE *var)
gum::O3prmBNWriter::_extractParents_
std::string _extractParents_(const IBayesNet< GUM_SCALAR > &bn, NodeId node)
gum::O3prmBNWriter::_extractCPT_
std::string _extractCPT_(const IBayesNet< GUM_SCALAR > &bn, NodeId node)
gum::O3prmBNWriter::~O3prmBNWriter
~O3prmBNWriter() override
Destructor.
gum::O3prmBNWriter::_doWrite
void _doWrite(std::string_view filePath, const IBayesNet< GUM_SCALAR > &bn) final
Writes a Bayes net in the file referenced by filePath.
gum::O3prmBNWriter::_extractLabelizedType_
std::string _extractLabelizedType_(const IBayesNet< GUM_SCALAR > &bn, NodeId node)
gum::O3prmBNWriter::_extractType_
std::string _extractType_(const IBayesNet< GUM_SCALAR > &bn, NodeId node)
gum::O3prmBNWriter::_extractAttribute_
std::string _extractAttribute_(const IBayesNet< GUM_SCALAR > &bn, NodeId node)
gum::O3prmBNWriter::_extractName_
std::string _extractName_(const IBayesNet< GUM_SCALAR > &bn, NodeId node)
gum::O3prmBNWriter::O3prmBNWriter
O3prmBNWriter()
Default constructor.
gum::NodeId
Size NodeId
Type for node ids.
Definition
graphElements.h:117
gum
gum is the global namespace for all aGrUM entities
Definition
agrum.h:46
aGrUM
3.2.0
© PHW&CG&others - 2022
DoXyGeN 1.18.0