![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
virtual class for writing a BN to a file. More...
#include <agrum/BN/io/BNWriter.h>
Public Member Functions | |
| BNWriter () | |
| Default constructor. | |
| virtual | ~BNWriter () |
| Default destructor. | |
| BNWriter (const BNWriter &)=default | |
| BNWriter (BNWriter &&) noexcept=default | |
| BNWriter & | operator= (const BNWriter &)=default |
| BNWriter & | operator= (BNWriter &&) noexcept=default |
| 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) |
Protected Member Functions | |
| virtual void | _doWrite (std::ostream &output, const IBayesNet< GUM_SCALAR > &bn)=0 |
| Writes a Bayesian network in the output stream. | |
| virtual void | _doWrite (const std::string &filePath, const IBayesNet< GUM_SCALAR > &bn)=0 |
| Writes a Bayesian network in the file referenced by filePath. | |
| 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 (const std::string &name) |
| } | |
| std::string | _buildNameWithOnlyValidChars (const std::string &name) |
| } | |
virtual class for writing a BN to a file.
Every class used to write the content of a Bayesian network in a stream, or a file must be a subclass of BNWriter.
Definition at line 77 of file BNWriter.h.
|
explicit |
Default constructor.
Referenced by BNWriter(), BNWriter(), operator=(), and operator=().
|
virtual |
Default destructor.
|
default |
|
defaultnoexcept |
|
protected |
}
References _buildNameWithOnlyValidChars().
Referenced by _buildNameWithOnlyValidChars().
|
protectedpure virtual |
Writes a Bayesian network in the file referenced by filePath.
If the file doesn't exists, it is created. If the file exists, it's content will be erased.
| 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. |
Implemented in gum::BIFWriter< GUM_SCALAR >, gum::BIFXMLBNWriter< GUM_SCALAR >, gum::CNFWriter< GUM_SCALAR, IApproximationPolicy >, gum::ContextualDependenciesCNFWriter< GUM_SCALAR, IApproximationPolicy >, gum::DSLWriter< GUM_SCALAR >, gum::FactorisedValuesCNFWriter< GUM_SCALAR, IApproximationPolicy >, gum::GeneralizedCNFWriter< GUM_SCALAR, IApproximationPolicy >, gum::NetWriter< GUM_SCALAR >, gum::O3prmBNWriter< GUM_SCALAR >, gum::UAIBNWriter< GUM_SCALAR >, and gum::XDSLBNWriter< GUM_SCALAR >.
References _doWrite().
|
protectedpure virtual |
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. |
Implemented in gum::BIFWriter< GUM_SCALAR >, gum::BIFXMLBNWriter< GUM_SCALAR >, gum::CNFWriter< GUM_SCALAR, IApproximationPolicy >, gum::CNFWriter< GUM_SCALAR, ExactPolicy >, gum::ContextualDependenciesCNFWriter< GUM_SCALAR, IApproximationPolicy >, gum::DSLWriter< GUM_SCALAR >, gum::FactorisedValuesCNFWriter< GUM_SCALAR, IApproximationPolicy >, gum::GeneralizedCNFWriter< GUM_SCALAR, IApproximationPolicy >, gum::NetWriter< GUM_SCALAR >, gum::O3prmBNWriter< GUM_SCALAR >, gum::UAIBNWriter< GUM_SCALAR >, and gum::XDSLBNWriter< GUM_SCALAR >.
References _doWrite().
Referenced by _doWrite(), and _doWrite().
|
protected |
}
References _onlyValidCharsInName().
Referenced by _onlyValidCharsInName().
|
protectedvirtual |
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().
|
protected |
}
References _validCharInNamesCheck().
Referenced by _validCharInNamesCheck().
| GUM_NODISCARD bool gum::BNWriter< GUM_SCALAR >::isModificationAllowed | ( | ) | const |
References GUM_NODISCARD, and isModificationAllowed().
Referenced by isModificationAllowed().
|
defaultnoexcept |
|
default |
| void gum::BNWriter< GUM_SCALAR >::setAllowModification | ( | bool | am | ) |
References setAllowModification().
Referenced by setAllowModification().
| void gum::BNWriter< GUM_SCALAR >::write | ( | const std::string & | filePath, |
| const IBayesNet< GUM_SCALAR > & | bn ) |
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().
| void gum::BNWriter< GUM_SCALAR >::write | ( | std::ostream & | output, |
| const IBayesNet< GUM_SCALAR > & | bn ) |
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().
|
private |
}
Definition at line 163 of file BNWriter.h.