![]() |
aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
|
#include <GumBNReader.h>
Public Member Functions | |
| GumBNReader (BayesNet< GUM_SCALAR > *bn, std::string_view filename, bool binary=false) | |
| Constructor A reader is defined for reading a defined file. | |
| GumBNReader (BayesNet< GUM_SCALAR > *bn) | |
| Constructor for string-based parsing only (no file). Use exclusively with proceedFromString(); calling proceed() will fail. | |
| ~GumBNReader () override | |
| Default destructor. | |
| Size | proceed () final |
| Parse the file given at construction. | |
| Size | proceedFromString (std::string_view content) |
| Parse a jgum JSON string directly (no file I/O). | |
| void | showElegantErrorsAndWarnings (std::ostream &stream=std::cerr) const |
| void | showErrorCounts (std::ostream &stream=std::cerr) const |
Accessors / Modifiers | |
| void | add (ParseError error) |
| Add an error object to the container. | |
| ParseError | error (Idx i) const |
| Returns the i-th error. | |
| ParseError | last () const |
| Returns the last added error. | |
| void | addError (std::string_view msg, std::string_view filename, Idx line, Idx col) |
| Adds an error. | |
| void | addWarning (std::string_view msg, std::string_view filename, Idx line, Idx col) |
| Adds a warning. | |
| void | addException (std::string_view msg, std::string_view filename) |
| Add an exception. | |
| Size | count () const |
| Returns the number of errors and warnings. | |
| void | syntheticResults (std::ostream &o) const |
| Print errors on output stream. | |
| void | simpleErrors (std::ostream &o) const |
| Print errors on output stream. | |
| void | simpleErrorsAndWarnings (std::ostream &o) const |
| Print errors on output stream. | |
| void | elegantErrors (std::ostream &o) const |
| Print errors on output stream. | |
| void | elegantErrorsAndWarnings (std::ostream &o) const |
| Print errors on output stream. | |
Coco/R helpers | |
| void | Error (const std::wstring &filename, Idx line, Idx col, const wchar_t *msg) |
| For adding errors. | |
| void | Warning (const std::wstring &filename, Idx line, Idx col, const wchar_t *msg) |
| For adding warnings. | |
| void | Exception (const std::wstring &filename, const wchar_t *msg) |
| For adding exceptions. | |
Class operators | |
| ErrorsContainer | operator+ (const ErrorsContainer &cont) const |
| Return the sum of two gum::ErrorsContainer. | |
| ErrorsContainer | operator+= (const ErrorsContainer &cont) |
| Add the content of a gum::ErrorsContainer to this gum::ErrorsContainer. | |
Public Attributes | |
| Size | error_count |
| Number of errors detected. | |
| Size | warning_count |
Private Member Functions | |
| template<typename JsonType> | |
| Size | _proceedFromJson_ (const JsonType &content) |
Private Attributes | |
| BayesNet< GUM_SCALAR > * | _bn_ |
| std::string | _streamName_ |
| bool | _parseDone_ |
| bool | _binary_ |
| If true, the input is in binary format, otherwise in text format. | |
| std::vector< ParseError > | errors |
| The list of gum::ParseError contained in this gum::ErrorsContainer. | |
Definition at line 57 of file GumBNReader.h.
| gum::GumBNReader< GUM_SCALAR >::GumBNReader | ( | BayesNet< GUM_SCALAR > * | bn, |
| std::string_view | filename, | ||
| bool | binary = false ) |
Constructor A reader is defined for reading a defined file.
Hence the 2 args of the constructor. Note that the BN has to be built outside the reader. There is no delegation to create/destroy the BN from inside the reader.
| bn | The BayesNet to fill with the read data. |
| filename | The name of the file to read. |
| binary | If true, the input is in binary format, otherwise in text format |
|
explicit |
Constructor for string-based parsing only (no file). Use exclusively with proceedFromString(); calling proceed() will fail.
|
override |
Default destructor.
|
private |
References _proceedFromJson_().
Referenced by _proceedFromJson_().
|
inherited |
Add an error object to the container.
| error | The gum::ParseError to add. |
Definition at line 74 of file errorsContainer_inl.h.
References error(), error_count, errors, and warning_count.
Referenced by addError(), addException(), addWarning(), Error(), Exception(), and Warning().
|
inherited |
Adds an error.
| msg | The error's message. |
| filename | The error's file. |
| line | The error's line. |
| col | The error's column. |
Definition at line 82 of file errorsContainer_inl.h.
References add().
|
inherited |
Add an exception.
| msg | The exception's message. |
| filename | The exception's file. |
Definition at line 98 of file errorsContainer_inl.h.
References add().
|
inherited |
Adds a warning.
| msg | The warning's message. |
| filename | The warning's file. |
| line | The warning's line. |
| col | The warning's column. |
Definition at line 90 of file errorsContainer_inl.h.
References add().
|
inherited |
Returns the number of errors and warnings.
Definition at line 103 of file errorsContainer_inl.h.
References error_count, and warning_count.
|
inherited |
Print errors on output stream.
| o | The output strem to send results. |
|
inherited |
Print errors on output stream.
| o | The output strem to send results. |
|
inherited |
For adding errors.
| filename | The error's file. |
| line | The error's line. |
| col | The error's column. |
| msg | The error's message. |
Definition at line 56 of file errorsContainer_inl.h.
References add(), and narrow().
|
inherited |
Returns the i-th error.
| i | The error to return. |
| OutOfBounds | Raised if there is less than i errors. |
Referenced by ErrorsContainer(), and add().
|
inherited |
For adding exceptions.
| filename | The exception's file. |
| msg | The exception's message. |
Definition at line 69 of file errorsContainer_inl.h.
References add(), and narrow().
|
inherited |
Returns the last added error.
| OutOfBounds | Raised if is no error to return. |
|
inherited |
Return the sum of two gum::ErrorsContainer.
| cont | The gum::ErrorsContainer to add. |
References ErrorsContainer().
|
inherited |
Add the content of a gum::ErrorsContainer to this gum::ErrorsContainer.
| cont | The gum::ErrorsContainer to add to this. |
References ErrorsContainer().
|
final |
Parse the file given at construction.
| Size gum::GumBNReader< GUM_SCALAR >::proceedFromString | ( | std::string_view | content | ) |
Parse a jgum JSON string directly (no file I/O).
References proceedFromString().
Referenced by proceedFromString().
| void gum::GumBNReader< GUM_SCALAR >::showElegantErrorsAndWarnings | ( | std::ostream & | stream = std::cerr | ) | const |
References showElegantErrorsAndWarnings().
Referenced by showElegantErrorsAndWarnings().
| void gum::GumBNReader< GUM_SCALAR >::showErrorCounts | ( | std::ostream & | stream = std::cerr | ) | const |
References showErrorCounts().
Referenced by showErrorCounts().
|
inherited |
Print errors on output stream.
| o | The output strem to send results. |
|
inherited |
Print errors on output stream.
| o | The output strem to send results. |
|
inherited |
Print errors on output stream.
| o | The output strem to send results. |
Definition at line 106 of file errorsContainer_inl.h.
References error_count, and warning_count.
|
inherited |
For adding warnings.
| filename | The warning's file. |
| line | The warning's line. |
| col | The warning's column. |
| msg | The warning's message. |
Definition at line 61 of file errorsContainer_inl.h.
References add(), and narrow().
|
private |
If true, the input is in binary format, otherwise in text format.
Definition at line 102 of file GumBNReader.h.
|
private |
Definition at line 99 of file GumBNReader.h.
|
private |
Definition at line 101 of file GumBNReader.h.
|
private |
Definition at line 100 of file GumBNReader.h.
|
inherited |
Number of errors detected.
Definition at line 186 of file errorsContainer.h.
Referenced by add(), count(), and syntheticResults().
|
mutableprivateinherited |
The list of gum::ParseError contained in this gum::ErrorsContainer.
Definition at line 182 of file errorsContainer.h.
Referenced by add().
|
inherited |
Definition at line 189 of file errorsContainer.h.
Referenced by add(), count(), and syntheticResults().