![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
Writes a IBayesNet in the BN format. More...
#include <agrum/BN/io/net/netWriter.h>
Public Member Functions | |
| void | write (std::ostream &output, const IBayesNet< GUM_SCALAR > &bn) |
| Writes a Bayesian network in the output stream. | |
| void | write (const std::string &filePath, const IBayesNet< GUM_SCALAR > &bn) |
| Writes a Bayesian network in the file referenced by filePath. | |
| GUM_NODISCARD bool | isModificationAllowed () const |
| void | setAllowModification (bool am) |
Constructor & destructor | |
| NetWriter () | |
| Default constructor. | |
| ~NetWriter () override | |
| Destructor. | |
| NetWriter (const NetWriter &)=default | |
| Default constructor. | |
| NetWriter (NetWriter &&) noexcept=default | |
| Default constructor. | |
| NetWriter & | operator= (const NetWriter &)=default |
| Default constructor. | |
| NetWriter & | operator= (NetWriter &&) noexcept=default |
| Default constructor. | |
Protected Member Functions | |
| void | _doWrite (std::ostream &output, const IBayesNet< GUM_SCALAR > &bn) final |
| Writes a Bayesian network in the output stream using the BN format. | |
| void | _doWrite (const std::string &filePath, const IBayesNet< GUM_SCALAR > &bn) final |
| Writes a Bayesian network in the referenced file using the BN format. | |
Private Member Functions | |
| std::string | _variableBloc_ (const DiscreteVariable &var) |
| std::string | _variableCPT_ (const Tensor< GUM_SCALAR > &cpt) |
Static Private Member Functions | |
| static std::string | _header_ (const IBayesNet< GUM_SCALAR > &bn) |
| virtual void | _syntacticalCheck (const IBayesNet< GUM_SCALAR > &bn) |
| Check whether the BN is syntactically correct for BIF format. | |
| void | _validCharInNamesCheck (const IBayesNet< GUM_SCALAR > &bn) |
| } | |
| std::string | _onlyValidCharsInName (const std::string &name) |
| } | |
| std::string | _buildNameWithOnlyValidChars (const std::string &name) |
| } | |
| bool | _allowModification_ = false |
| } | |
Writes a IBayesNet in the BN format.
This class servers to write the content of a Bayesian network in the BN format. See TODO for information on this format.
Definition at line 76 of file netWriter.h.
| gum::NetWriter< GUM_SCALAR >::NetWriter | ( | ) |
Default constructor.
Referenced by NetWriter(), NetWriter(), _variableCPT_(), operator=(), and operator=().
|
override |
Destructor.
|
default |
|
defaultnoexcept |
|
protectedinherited |
}
References _buildNameWithOnlyValidChars().
Referenced by _buildNameWithOnlyValidChars().
|
finalprotectedvirtual |
Writes a Bayesian network in the referenced file using the BN format.
If the files do not exist, it is created.
| filePath | The path to the file used to write the Bayesian network. |
| bn | The Bayesian network written in the file. |
| IOError | Raised if and I/O error occurs. |
Implements gum::BNWriter< GUM_SCALAR >.
References _doWrite().
|
finalprotectedvirtual |
Writes a Bayesian network in the output stream using the BN format.
| output | The output stream. |
| bn | The Bayesian network writen in output. |
| IOError | Raised if and I/O error occurs. |
Implements gum::BNWriter< GUM_SCALAR >.
References _doWrite().
Referenced by _doWrite(), and _doWrite().
|
staticprivate |
References _header_().
Referenced by _header_().
|
protectedinherited |
}
References _onlyValidCharsInName().
Referenced by _onlyValidCharsInName().
|
protectedvirtualinherited |
Check whether the BN is syntactically correct for BIF format.
| FatalError | if found. |
Reimplemented in gum::BIFWriter< GUM_SCALAR >, and gum::DSLWriter< GUM_SCALAR >.
References _syntacticalCheck().
Referenced by _syntacticalCheck().
|
protectedinherited |
}
References _validCharInNamesCheck().
Referenced by _validCharInNamesCheck().
|
private |
References _variableBloc_().
Referenced by _variableBloc_().
|
private |
References NetWriter(), and _variableCPT_().
Referenced by _variableCPT_().
|
inherited |
References GUM_NODISCARD, and isModificationAllowed().
Referenced by isModificationAllowed().
|
default |
|
defaultnoexcept |
|
inherited |
References setAllowModification().
Referenced by setAllowModification().
|
inherited |
Writes a Bayesian network in the file referenced by filePath.
| filePath | The path to the file used to write the Bayesian network. |
| bn | The Bayesian network writen in the file. |
| IOError | Raised if an I/O error occurs. |
References write().
|
inherited |
Writes a Bayesian network in the output stream.
| output | The output stream. |
| bn | The Bayesian network written in output. |
| IOError | Raised if an I/O error occurs. |
| SyntaxError | Raised if syntactical errors in the BN |
References write().
Referenced by gum::credal::CredalNet< GUM_SCALAR >::saveBNsMinMax(), write(), and write().
|
privateinherited |
}
Definition at line 163 of file BNWriter.h.