aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
gum::MRFWriter< GUM_SCALAR > Class Template Referenceabstract

Pure virtual class for writing a MRF to a file. More...

#include <agrum/MRF/io/MRFWriter.h>

Inheritance diagram for gum::MRFWriter< GUM_SCALAR >:

Public Member Functions

 MRFWriter ()
 Default constructor.
virtual ~MRFWriter ()
 Default destructor.
virtual void write (std::ostream &output, const IMarkovRandomField< GUM_SCALAR > &MN)=0
 Writes a Markov random field to the output stream.
virtual void write (std::string_view filePath, const IMarkovRandomField< GUM_SCALAR > &MN)=0
 Writes a Markov random field in the file referenced by filePath.
virtual void write (std::string_view filePath, IMarkovRandomField< GUM_SCALAR > &MN)
 Writes a Markov random field in the file referenced by filePath, updating metadata (software, creation, lastModification) before writing.

Detailed Description

template<GUM_Numeric GUM_SCALAR>
class gum::MRFWriter< GUM_SCALAR >

Pure virtual class for writing a MRF to a file.

Every class used to write the content of a Markov random field in a stream, or a file must be a subclass of MRFWriter.

Definition at line 81 of file MRFWriter.h.

Constructor & Destructor Documentation

◆ MRFWriter()

template<GUM_Numeric GUM_SCALAR>
gum::MRFWriter< GUM_SCALAR >::MRFWriter ( )

Default constructor.

◆ ~MRFWriter()

template<GUM_Numeric GUM_SCALAR>
virtual gum::MRFWriter< GUM_SCALAR >::~MRFWriter ( )
virtual

Default destructor.

Member Function Documentation

◆ write() [1/3]

template<GUM_Numeric GUM_SCALAR>
virtual void gum::MRFWriter< GUM_SCALAR >::write ( std::ostream & output,
const IMarkovRandomField< GUM_SCALAR > & MN )
pure virtual

Writes a Markov random field to the output stream.

Parameters
outputThe output stream.
MNThe Markov random field written to the stream.
Exceptions
IOErrorRaised if an I/O error occurs.

Implemented in gum::GumMRFWriter< GUM_SCALAR >, and gum::UAIMRFWriter< GUM_SCALAR >.

◆ write() [2/3]

template<GUM_Numeric GUM_SCALAR>
virtual void gum::MRFWriter< GUM_SCALAR >::write ( std::string_view filePath,
const IMarkovRandomField< GUM_SCALAR > & MN )
pure virtual

Writes a Markov random field 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 Markov random field.
MNThe Markov random field written to the file.
Exceptions
IOErrorRaised if an I/O error occurs.

Implemented in gum::GumMRFWriter< GUM_SCALAR >, and gum::UAIMRFWriter< GUM_SCALAR >.

◆ write() [3/3]

template<GUM_Numeric GUM_SCALAR>
virtual void gum::MRFWriter< GUM_SCALAR >::write ( std::string_view filePath,
IMarkovRandomField< GUM_SCALAR > & MN )
virtual

Writes a Markov random field in the file referenced by filePath, updating metadata (software, creation, lastModification) before writing.

If the file doesn't exists, it is created. If the file exists, it's content will be erased.

Default implementation delegates to the const overload.

Parameters
filePathThe path to the file used to write the Markov random field.
MNThe Markov random field written to the file (non-const to allow metadata update).
Exceptions
IOErrorRaised if an I/O error occurs.

Reimplemented in gum::GumMRFWriter< GUM_SCALAR >.


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