![]() |
aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
|
Writes a MarkovRandomField in the GUM json format. More...
#include <agrum/MRF/io/GUM/GumMRFWriter.h>
Public Member Functions | |
| std::string | toString (const IMarkovRandomField< GUM_SCALAR > &mrf) |
| Serializes a MarkovRandomField to a string in GUM json format. | |
| void | write (std::ostream &output, const IMarkovRandomField< GUM_SCALAR > &mrf) override |
| Writes a MarkovRandomField to the output stream. | |
| void | write (std::string_view filePath, IMarkovRandomField< GUM_SCALAR > &mrf) override |
| Writes a MarkovRandomField to the file at filePath, updating metadata first. | |
| void | write (std::string_view filePath, const IMarkovRandomField< GUM_SCALAR > &mrf) override |
| Writes a MarkovRandomField to the file at filePath (const variant, no metadata update). | |
Constructor & destructor | |
| GumMRFWriter (bool binary=false, int indent=-1) | |
| Default constructor. | |
| ~GumMRFWriter () override | |
| Default constructor. | |
| GumMRFWriter (const GumMRFWriter &)=delete | |
| Default constructor. | |
| GumMRFWriter (GumMRFWriter &&) noexcept=delete | |
| Default constructor. | |
| GumMRFWriter & | operator= (const GumMRFWriter &)=delete |
| Default constructor. | |
| GumMRFWriter & | operator= (GumMRFWriter &&) noexcept=delete |
| Default constructor. | |
Private Attributes | |
| bool | _binary_ |
| int | _indent_ |
Writes a MarkovRandomField in the GUM json format.
Each factor is serialized as an inline object {"vars": [...], "values": [...]}, avoiding any key-separator ambiguity with variable names.
Supports both text (.jgum) and binary msgpack (.bgum) output.
Definition at line 75 of file GumMRFWriter.h.
| gum::GumMRFWriter< GUM_SCALAR >::GumMRFWriter | ( | bool | binary = false, |
| int | indent = -1 ) |
Default constructor.
| binary | If true, output uses the msgpack binary format; otherwise JSON text. |
| indent | Indentation level for text output. -1 produces compact output. |
Referenced by GumMRFWriter(), GumMRFWriter(), operator=(), and operator=().
|
override |
Default constructor.
| binary | If true, output uses the msgpack binary format; otherwise JSON text. |
| indent | Indentation level for text output. -1 produces compact output. |
|
delete |
Default constructor.
| binary | If true, output uses the msgpack binary format; otherwise JSON text. |
| indent | Indentation level for text output. -1 produces compact output. |
References GumMRFWriter().
|
deletenoexcept |
Default constructor.
| binary | If true, output uses the msgpack binary format; otherwise JSON text. |
| indent | Indentation level for text output. -1 produces compact output. |
References GumMRFWriter().
|
delete |
Default constructor.
| binary | If true, output uses the msgpack binary format; otherwise JSON text. |
| indent | Indentation level for text output. -1 produces compact output. |
References GumMRFWriter().
|
deletenoexcept |
Default constructor.
| binary | If true, output uses the msgpack binary format; otherwise JSON text. |
| indent | Indentation level for text output. -1 produces compact output. |
References GumMRFWriter().
| std::string gum::GumMRFWriter< GUM_SCALAR >::toString | ( | const IMarkovRandomField< GUM_SCALAR > & | mrf | ) |
Serializes a MarkovRandomField to a string in GUM json format.
References toString().
Referenced by toString().
|
overridevirtual |
Writes a MarkovRandomField to the output stream.
| output | The output stream. |
| mrf | The MarkovRandomField to write. |
| IOError | if the stream is not writable. |
Implements gum::MRFWriter< GUM_SCALAR >.
References write().
Referenced by write(), write(), and write().
|
overridevirtual |
Writes a MarkovRandomField to the file at filePath (const variant, no metadata update).
| filePath | Path to the output file (created or overwritten). |
| mrf | The MarkovRandomField to write. |
| IOError | if an I/O error occurs. |
Implements gum::MRFWriter< GUM_SCALAR >.
References write().
|
overridevirtual |
Writes a MarkovRandomField to the file at filePath, updating metadata first.
| filePath | Path to the output file (created or overwritten). |
| mrf | The MarkovRandomField to write (non-const to allow metadata update). |
| IOError | if an I/O error occurs. |
Reimplemented from gum::MRFWriter< GUM_SCALAR >.
References write().
|
private |
Definition at line 132 of file GumMRFWriter.h.
|
private |
Definition at line 133 of file GumMRFWriter.h.