![]() |
aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
|
Writes a IBayesNet in the GUM json format. More...
#include <agrum/BN/io/GUM/GumBNWriter.h>
Public Member Functions | |
| void | write (std::ostream &output, IBayesNet< GUM_SCALAR > &bn) |
| Writes a Bayesian network in the output stream. | |
| void | write (std::string_view filePath, IBayesNet< GUM_SCALAR > &bn) |
| Writes a Bayesian network in the file referenced by filePath. | |
| GUM_NODISCARD bool | isModificationAllowed () const |
| void | setAllowModification (bool am) |
| std::string | toString (const IBayesNet< GUM_SCALAR > &bn) |
Constructor & destructor | |
| GumBNWriter (bool binary=false, int indent=-1) | |
| Default constructor. | |
| ~GumBNWriter () override | |
| Destructor. | |
| GumBNWriter (const GumBNWriter &)=delete | |
| Default constructor. | |
| GumBNWriter (GumBNWriter &&) noexcept=delete | |
| Default constructor. | |
| GumBNWriter & | operator= (const GumBNWriter &)=delete |
| Default constructor. | |
| GumBNWriter & | operator= (GumBNWriter &&) noexcept=delete |
| 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 (std::string_view filePath, const IBayesNet< GUM_SCALAR > &bn) final |
| Writes a Bayesian network in the referenced file using the BN format. | |
Private Attributes | |
| bool | _binary_ |
| If true, the output will be in binary format, otherwise in text format. | |
| int | _indent_ |
| The indentation level for the output. | |
| bool | _allowModification_ = false |
| } | |
| 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 (std::string_view name) |
| } | |
| std::string | _buildNameWithOnlyValidChars (std::string_view name) |
| } | |
Writes a IBayesNet in the GUM json format.
This class to write the content of a Bayesian network in the GUM json format.
Definition at line 80 of file GumBNWriter.h.
| gum::GumBNWriter< GUM_SCALAR >::GumBNWriter | ( | bool | binary = false, |
| int | indent = -1 ) |
Default constructor.
JGUM format is a json format. In binary mode, the output use the BJData format.
| binary | If true, the output will be in binary format, otherwise in text format. |
| indent | The indentation level for the output in text format. If -1, the format is as compact as possible. |
Referenced by GumBNWriter(), GumBNWriter(), operator=(), and operator=().
|
override |
Destructor.
|
delete |
Default constructor.
JGUM format is a json format. In binary mode, the output use the BJData format.
| binary | If true, the output will be in binary format, otherwise in text format. |
| indent | The indentation level for the output in text format. If -1, the format is as compact as possible. |
References GumBNWriter().
|
deletenoexcept |
Default constructor.
JGUM format is a json format. In binary mode, the output use the BJData format.
| binary | If true, the output will be in binary format, otherwise in text format. |
| indent | The indentation level for the output in text format. If -1, the format is as compact as possible. |
References GumBNWriter().
|
protectedinherited |
}
References _buildNameWithOnlyValidChars().
Referenced by _buildNameWithOnlyValidChars().
|
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().
|
finalprotectedvirtual |
Writes a Bayesian network in the referenced file using the BN format.
If the files doesn't exists, it is created.
| filePath | The path to the file used to write the Bayesian network. |
| bn | The Bayesian network writed in the file. |
| IOError | Raised if and I/O error occurs. |
Implements gum::BNWriter< GUM_SCALAR >.
References _doWrite().
|
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().
|
inherited |
References GUM_NODISCARD, and isModificationAllowed().
Referenced by isModificationAllowed().
|
delete |
Default constructor.
JGUM format is a json format. In binary mode, the output use the BJData format.
| binary | If true, the output will be in binary format, otherwise in text format. |
| indent | The indentation level for the output in text format. If -1, the format is as compact as possible. |
References GumBNWriter().
|
deletenoexcept |
Default constructor.
JGUM format is a json format. In binary mode, the output use the BJData format.
| binary | If true, the output will be in binary format, otherwise in text format. |
| indent | The indentation level for the output in text format. If -1, the format is as compact as possible. |
References GumBNWriter().
|
inherited |
References setAllowModification().
Referenced by setAllowModification().
|
inherited |
References toString().
Referenced by toString().
|
inherited |
Writes a Bayesian network in the output stream.
| output | The output stream. |
| bn | The Bayesian network written in output (not const since updateMetaData). |
| 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().
|
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 written to the file (not const since updateMetaData). |
| IOError | Raised if an I/O error occurs. |
References write().
|
privateinherited |
}
Definition at line 167 of file BNWriter.h.
|
private |
If true, the output will be in binary format, otherwise in text format.
Definition at line 131 of file GumBNWriter.h.
|
private |
The indentation level for the output.
Definition at line 132 of file GumBNWriter.h.