aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::XDSLBNWriter< GUM_SCALAR > Class Template Reference

<agrum/BN/io/XDSLXML/XDSLBNWriter.h> More...

#include <XDSLBNWriter.h>

Inheritance diagram for gum::XDSLBNWriter< GUM_SCALAR >:
Collaboration diagram for gum::XDSLBNWriter< GUM_SCALAR >:

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
 XDSLBNWriter ()
 Default constructor.
 ~XDSLBNWriter () override
 Destructor.
 XDSLBNWriter (const XDSLBNWriter &)=default
 Default constructor.
 XDSLBNWriter (XDSLBNWriter &&) noexcept=default
 Default constructor.
XDSLBNWriteroperator= (const XDSLBNWriter &)=default
 Default constructor.
XDSLBNWriteroperator= (XDSLBNWriter &&) noexcept=default
 Default constructor.

Protected Member Functions

void _doWrite (std::ostream &output, const IBayesNet< GUM_SCALAR > &bn) final
 Writes an bayes net in the given ouput stream.
void _doWrite (const std::string &filePath, const IBayesNet< GUM_SCALAR > &bn) final
 Writes an bayes net in the file referenced by filePath.

Private Member Functions

void _heading_ (std::ostream &output, const IBayesNet< GUM_SCALAR > &bn)
 send to output the header of the XDSL file.
void _documentEnd_ (std::ostream &output)
 send to output the end of the XDSL file.
void _headingExtension_ (std::ostream &output, const IBayesNet< GUM_SCALAR > &bn)
void _endExtension_ (std::ostream &output)
void _variableBloc_ (std::ostream &output, const NodeId &varNodeId, const IBayesNet< GUM_SCALAR > &bn)
 send to output a bloc defining a variable in the XDSL format.
void _variableExtension_ (std::ostream &output, const NodeId &varNodeId, const IBayesNet< GUM_SCALAR > &bn)
 send to output a bloc defining a variable's extensoion in the XDSL
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
 }

Detailed Description

template<typename GUM_SCALAR>
class gum::XDSLBNWriter< GUM_SCALAR >

<agrum/BN/io/XDSLXML/XDSLBNWriter.h>

Writes an bayes net in a XML file with XDSL format

This class export a bayes net into an XML files, using XDSL format

Definition at line 78 of file XDSLBNWriter.h.

Constructor & Destructor Documentation

◆ XDSLBNWriter() [1/3]

template<typename GUM_SCALAR>
gum::XDSLBNWriter< GUM_SCALAR >::XDSLBNWriter ( )

Default constructor.

Referenced by XDSLBNWriter(), XDSLBNWriter(), _variableExtension_(), operator=(), and operator=().

Here is the caller graph for this function:

◆ ~XDSLBNWriter()

template<typename GUM_SCALAR>
gum::XDSLBNWriter< GUM_SCALAR >::~XDSLBNWriter ( )
override

Destructor.

◆ XDSLBNWriter() [2/3]

template<typename GUM_SCALAR>
gum::XDSLBNWriter< GUM_SCALAR >::XDSLBNWriter ( const XDSLBNWriter< GUM_SCALAR > & )
default

Default constructor.

References XDSLBNWriter().

Here is the call graph for this function:

◆ XDSLBNWriter() [3/3]

template<typename GUM_SCALAR>
gum::XDSLBNWriter< GUM_SCALAR >::XDSLBNWriter ( XDSLBNWriter< GUM_SCALAR > && )
defaultnoexcept

Default constructor.

References XDSLBNWriter().

Here is the call graph for this function:

Member Function Documentation

◆ _buildNameWithOnlyValidChars()

template<typename GUM_SCALAR>
std::string gum::BNWriter< GUM_SCALAR >::_buildNameWithOnlyValidChars ( const std::string & name)
protectedinherited

}

References _buildNameWithOnlyValidChars().

Referenced by _buildNameWithOnlyValidChars().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _documentEnd_()

template<typename GUM_SCALAR>
void gum::XDSLBNWriter< GUM_SCALAR >::_documentEnd_ ( std::ostream & output)
private

send to output the end of the XDSL file.

References _documentEnd_().

Referenced by _documentEnd_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _doWrite() [1/2]

template<typename GUM_SCALAR>
void gum::XDSLBNWriter< GUM_SCALAR >::_doWrite ( const std::string & filePath,
const IBayesNet< GUM_SCALAR > & bn )
finalprotectedvirtual

Writes an bayes net 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.

Parameters
filePathThe path to the file used to write the bayes net.
bnThe bayes net writen in the file.
Exceptions
IOErrorRaised if an I/O error occurs.

Implements gum::BNWriter< GUM_SCALAR >.

References _doWrite().

Here is the call graph for this function:

◆ _doWrite() [2/2]

template<typename GUM_SCALAR>
void gum::XDSLBNWriter< GUM_SCALAR >::_doWrite ( std::ostream & output,
const IBayesNet< GUM_SCALAR > & bn )
finalprotectedvirtual

Writes an bayes net in the given ouput stream.

Parameters
outputThe output stream.
bnThe bayes net writen in the stream.
Exceptions
IOErrorRaised if an I/O error occurs.

Implements gum::BNWriter< GUM_SCALAR >.

References _doWrite().

Referenced by _doWrite(), and _doWrite().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _endExtension_()

template<typename GUM_SCALAR>
void gum::XDSLBNWriter< GUM_SCALAR >::_endExtension_ ( std::ostream & output)
private

References _endExtension_().

Referenced by _endExtension_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _heading_()

template<typename GUM_SCALAR>
void gum::XDSLBNWriter< GUM_SCALAR >::_heading_ ( std::ostream & output,
const IBayesNet< GUM_SCALAR > & bn )
private

send to output the header of the XDSL file.

References _heading_().

Referenced by _heading_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _headingExtension_()

template<typename GUM_SCALAR>
void gum::XDSLBNWriter< GUM_SCALAR >::_headingExtension_ ( std::ostream & output,
const IBayesNet< GUM_SCALAR > & bn )
private

References _headingExtension_().

Referenced by _headingExtension_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _onlyValidCharsInName()

template<typename GUM_SCALAR>
std::string gum::BNWriter< GUM_SCALAR >::_onlyValidCharsInName ( const std::string & name)
protectedinherited

}

References _onlyValidCharsInName().

Referenced by _onlyValidCharsInName().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _syntacticalCheck()

template<typename GUM_SCALAR>
virtual void gum::BNWriter< GUM_SCALAR >::_syntacticalCheck ( const IBayesNet< GUM_SCALAR > & bn)
protectedvirtualinherited

Check whether the BN is syntactically correct for BIF format.

Exceptions
FatalErrorif found.

Reimplemented in gum::BIFWriter< GUM_SCALAR >, and gum::DSLWriter< GUM_SCALAR >.

References _syntacticalCheck().

Referenced by _syntacticalCheck().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _validCharInNamesCheck()

template<typename GUM_SCALAR>
void gum::BNWriter< GUM_SCALAR >::_validCharInNamesCheck ( const IBayesNet< GUM_SCALAR > & bn)
protectedinherited

}

References _validCharInNamesCheck().

Referenced by _validCharInNamesCheck().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _variableBloc_()

template<typename GUM_SCALAR>
void gum::XDSLBNWriter< GUM_SCALAR >::_variableBloc_ ( std::ostream & output,
const NodeId & varNodeId,
const IBayesNet< GUM_SCALAR > & bn )
private

send to output a bloc defining a variable in the XDSL format.

References _variableBloc_().

Referenced by _variableBloc_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _variableExtension_()

template<typename GUM_SCALAR>
void gum::XDSLBNWriter< GUM_SCALAR >::_variableExtension_ ( std::ostream & output,
const NodeId & varNodeId,
const IBayesNet< GUM_SCALAR > & bn )
private

send to output a bloc defining a variable's extensoion in the XDSL

References XDSLBNWriter(), and _variableExtension_().

Referenced by _variableExtension_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isModificationAllowed()

template<typename GUM_SCALAR>
GUM_NODISCARD bool gum::BNWriter< GUM_SCALAR >::isModificationAllowed ( ) const
inherited

References GUM_NODISCARD, and isModificationAllowed().

Referenced by isModificationAllowed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

template<typename GUM_SCALAR>
XDSLBNWriter & gum::XDSLBNWriter< GUM_SCALAR >::operator= ( const XDSLBNWriter< GUM_SCALAR > & )
default

Default constructor.

References XDSLBNWriter().

Here is the call graph for this function:

◆ operator=() [2/2]

template<typename GUM_SCALAR>
XDSLBNWriter & gum::XDSLBNWriter< GUM_SCALAR >::operator= ( XDSLBNWriter< GUM_SCALAR > && )
defaultnoexcept

Default constructor.

References XDSLBNWriter().

Here is the call graph for this function:

◆ setAllowModification()

template<typename GUM_SCALAR>
void gum::BNWriter< GUM_SCALAR >::setAllowModification ( bool am)
inherited

References setAllowModification().

Referenced by setAllowModification().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write() [1/2]

template<typename GUM_SCALAR>
void gum::BNWriter< GUM_SCALAR >::write ( const std::string & filePath,
const IBayesNet< GUM_SCALAR > & bn )
inherited

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.
  • If the bn can not be written for syntactical reasons, throw an error or try to correct it (conditioned by the value of allowModification
Parameters
filePathThe path to the file used to write the Bayesian network.
bnThe Bayesian network writen in the file.
Exceptions
IOErrorRaised if an I/O error occurs.

References write().

Here is the call graph for this function:

◆ write() [2/2]

template<typename GUM_SCALAR>
void gum::BNWriter< GUM_SCALAR >::write ( std::ostream & output,
const IBayesNet< GUM_SCALAR > & bn )
inherited

Writes a Bayesian network in the output stream.

  • If the bn can not be written for syntactical reasons, throw an error or try to correct it (conditioned by the value of allowModification
Parameters
outputThe output stream.
bnThe Bayesian network written in output.
Exceptions
IOErrorRaised if an I/O error occurs.
SyntaxErrorRaised if syntactical errors in the BN

References write().

Referenced by gum::credal::CredalNet< GUM_SCALAR >::saveBNsMinMax(), write(), and write().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _allowModification_

template<typename GUM_SCALAR>
bool gum::BNWriter< GUM_SCALAR >::_allowModification_ = false
privateinherited

}

Definition at line 163 of file BNWriter.h.


The documentation for this class was generated from the following file: