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

Writes an InfluenceDiagram in the GUM json format. More...

#include <agrum/ID/io/GUM/GumIDWriter.h>

Inheritance diagram for gum::GumIDWriter< GUM_SCALAR >:
[legend]
Collaboration diagram for gum::GumIDWriter< GUM_SCALAR >:
[legend]

Public Member Functions

std::string toString (const InfluenceDiagram< GUM_SCALAR > &id)
 Serializes an InfluenceDiagram to a string in GUM json format.
void write (std::ostream &output, const InfluenceDiagram< GUM_SCALAR > &id) override
 Writes an InfluenceDiagram to the output stream.
void write (std::string_view filePath, InfluenceDiagram< GUM_SCALAR > &id) override
 Writes an InfluenceDiagram to the file at filePath, updating metadata first.
void write (std::string_view filePath, const InfluenceDiagram< GUM_SCALAR > &id) override
 Writes an InfluenceDiagram to the file at filePath (const variant, no metadata update).
Constructor & destructor
 GumIDWriter (bool binary=false)
 Default constructor.
 GumIDWriter (bool binary, int indent)
 Constructor with an explicit indentation (the configuration is not used).
 ~GumIDWriter () override
 Default constructor.
 GumIDWriter (const GumIDWriter &)=delete
 Default constructor.
 GumIDWriter (GumIDWriter &&) noexcept=delete
 Default constructor.
GumIDWriter & operator= (const GumIDWriter &)=delete
 Default constructor.
GumIDWriter & operator= (GumIDWriter &&) noexcept=delete
 Default constructor.

Private Attributes

bool _binary_
int _indent_

Detailed Description

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

Writes an InfluenceDiagram in the GUM json format.

Supports both text (.jgum) and binary msgpack (.bgum) output.

Definition at line 72 of file GumIDWriter.h.

Constructor & Destructor Documentation

◆ GumIDWriter() [1/4]

template<GUM_Numeric GUM_SCALAR>
gum::GumIDWriter< GUM_SCALAR >::GumIDWriter ( bool binary = false)

Default constructor.

The indentation is the one of the configuration (key jgumIndent of section core, see gum::Configuration).

Parameters
binaryIf true, output uses the msgpack binary format; otherwise JSON text.

Referenced by GumIDWriter(), GumIDWriter(), operator=(), and operator=().

Here is the caller graph for this function:

◆ GumIDWriter() [2/4]

template<GUM_Numeric GUM_SCALAR>
gum::GumIDWriter< GUM_SCALAR >::GumIDWriter ( bool binary,
int indent )

Constructor with an explicit indentation (the configuration is not used).

Parameters
binaryIf true, output uses the msgpack binary format; otherwise JSON text.
indentIndentation level for text output. -1 produces compact output.

◆ ~GumIDWriter()

template<GUM_Numeric GUM_SCALAR>
gum::GumIDWriter< GUM_SCALAR >::~GumIDWriter ( )
override

Default constructor.

The indentation is the one of the configuration (key jgumIndent of section core, see gum::Configuration).

Parameters
binaryIf true, output uses the msgpack binary format; otherwise JSON text.

◆ GumIDWriter() [3/4]

template<GUM_Numeric GUM_SCALAR>
gum::GumIDWriter< GUM_SCALAR >::GumIDWriter ( const GumIDWriter< GUM_SCALAR > & )
delete

Default constructor.

The indentation is the one of the configuration (key jgumIndent of section core, see gum::Configuration).

Parameters
binaryIf true, output uses the msgpack binary format; otherwise JSON text.

References GumIDWriter().

Here is the call graph for this function:

◆ GumIDWriter() [4/4]

template<GUM_Numeric GUM_SCALAR>
gum::GumIDWriter< GUM_SCALAR >::GumIDWriter ( GumIDWriter< GUM_SCALAR > && )
deletenoexcept

Default constructor.

The indentation is the one of the configuration (key jgumIndent of section core, see gum::Configuration).

Parameters
binaryIf true, output uses the msgpack binary format; otherwise JSON text.

References GumIDWriter().

Here is the call graph for this function:

Member Function Documentation

◆ operator=() [1/2]

template<GUM_Numeric GUM_SCALAR>
GumIDWriter & gum::GumIDWriter< GUM_SCALAR >::operator= ( const GumIDWriter< GUM_SCALAR > & )
delete

Default constructor.

The indentation is the one of the configuration (key jgumIndent of section core, see gum::Configuration).

Parameters
binaryIf true, output uses the msgpack binary format; otherwise JSON text.

References GumIDWriter().

Here is the call graph for this function:

◆ operator=() [2/2]

template<GUM_Numeric GUM_SCALAR>
GumIDWriter & gum::GumIDWriter< GUM_SCALAR >::operator= ( GumIDWriter< GUM_SCALAR > && )
deletenoexcept

Default constructor.

The indentation is the one of the configuration (key jgumIndent of section core, see gum::Configuration).

Parameters
binaryIf true, output uses the msgpack binary format; otherwise JSON text.

References GumIDWriter().

Here is the call graph for this function:

◆ toString()

template<GUM_Numeric GUM_SCALAR>
std::string gum::GumIDWriter< GUM_SCALAR >::toString ( const InfluenceDiagram< GUM_SCALAR > & id)

Serializes an InfluenceDiagram to a string in GUM json format.

References toString().

Referenced by toString().

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

◆ write() [1/3]

template<GUM_Numeric GUM_SCALAR>
void gum::GumIDWriter< GUM_SCALAR >::write ( std::ostream & output,
const InfluenceDiagram< GUM_SCALAR > & id )
overridevirtual

Writes an InfluenceDiagram to the output stream.

Parameters
outputThe output stream.
idThe InfluenceDiagram to write.
Exceptions
IOErrorif the stream is not writable.

Implements gum::IDWriter< GUM_SCALAR >.

References write().

Referenced by write(), write(), and write().

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

◆ write() [2/3]

template<GUM_Numeric GUM_SCALAR>
void gum::GumIDWriter< GUM_SCALAR >::write ( std::string_view filePath,
const InfluenceDiagram< GUM_SCALAR > & id )
overridevirtual

Writes an InfluenceDiagram to the file at filePath (const variant, no metadata update).

Parameters
filePathPath to the output file (created or overwritten).
idThe InfluenceDiagram to write.
Exceptions
IOErrorif an I/O error occurs.

Implements gum::IDWriter< GUM_SCALAR >.

References write().

Here is the call graph for this function:

◆ write() [3/3]

template<GUM_Numeric GUM_SCALAR>
void gum::GumIDWriter< GUM_SCALAR >::write ( std::string_view filePath,
InfluenceDiagram< GUM_SCALAR > & id )
overridevirtual

Writes an InfluenceDiagram to the file at filePath, updating metadata first.

Parameters
filePathPath to the output file (created or overwritten).
idThe InfluenceDiagram to write (non-const to allow metadata update).
Exceptions
IOErrorif an I/O error occurs.

Reimplemented from gum::IDWriter< GUM_SCALAR >.

References write().

Here is the call graph for this function:

Member Data Documentation

◆ _binary_

template<GUM_Numeric GUM_SCALAR>
bool gum::GumIDWriter< GUM_SCALAR >::_binary_
private

Definition at line 137 of file GumIDWriter.h.

◆ _indent_

template<GUM_Numeric GUM_SCALAR>
int gum::GumIDWriter< GUM_SCALAR >::_indent_
private

Definition at line 138 of file GumIDWriter.h.


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