aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::ErrorsContainer Class Reference

This class is used contain and manipulate gum::ParseError. More...

#include <agrum/base/core/errorsContainer.h>

Public Member Functions

Class Constructor
 ErrorsContainer ()
 Class Constructor.
 ErrorsContainer (const ErrorsContainer &cont)
 Copy constructor.
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 (const std::string &msg, const std::string &filename, Idx line, Idx col)
 Adds an error.
void addWarning (const std::string &msg, const std::string &filename, Idx line, Idx col)
 Adds a warning.
void addException (const std::string &msg, const std::string &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)
 Copy Operator.
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 Attributes

std::vector< ParseErrorerrors
 The list of gum::ParseError contained in this gum::ErrorsContainer.

Detailed Description

This class is used contain and manipulate gum::ParseError.

Definition at line 180 of file errorsContainer.h.

Constructor & Destructor Documentation

◆ ErrorsContainer() [1/2]

gum::ErrorsContainer::ErrorsContainer ( )

Class Constructor.

Referenced by ErrorsContainer(), operator+(), operator+=(), and operator=().

Here is the caller graph for this function:

◆ ErrorsContainer() [2/2]

gum::ErrorsContainer::ErrorsContainer ( const ErrorsContainer & cont)

Copy constructor.

Parameters
contThe ErrorsContainer to copy.

References ErrorsContainer(), and error().

Here is the call graph for this function:

Member Function Documentation

◆ add()

INLINE void gum::ErrorsContainer::add ( ParseError error)

Add an error object to the container.

Parameters
errorThe gum::ParseError to add.

Definition at line 73 of file errorsContainer_inl.h.

73 {
74 errors.push_back(error);
75
76 if (error.is_error) error_count++;
77 else warning_count++;
78 }
ParseError error(Idx i) const
Returns the i-th error.
Size error_count
Number of errors detected.
std::vector< ParseError > errors
The list of gum::ParseError contained in this gum::ErrorsContainer.

References error(), error_count, errors, and warning_count.

Referenced by addError(), addException(), addWarning(), Error(), Exception(), and Warning().

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

◆ addError()

INLINE void gum::ErrorsContainer::addError ( const std::string & msg,
const std::string & filename,
Idx line,
Idx col )

Adds an error.

Parameters
msgThe error's message.
filenameThe error's file.
lineThe error's line.
colThe error's column.

Definition at line 81 of file errorsContainer_inl.h.

84 {
85 add(ParseError(true, msg, filename, line, col));
86 }
void add(ParseError error)
Add an error object to the container.

References add().

Here is the call graph for this function:

◆ addException()

INLINE void gum::ErrorsContainer::addException ( const std::string & msg,
const std::string & filename )

Add an exception.

Parameters
msgThe exception's message.
filenameThe exception's file.

Definition at line 97 of file errorsContainer_inl.h.

97 {
98 add(ParseError(true, msg, filename, 0, 0));
99 }

References add().

Here is the call graph for this function:

◆ addWarning()

INLINE void gum::ErrorsContainer::addWarning ( const std::string & msg,
const std::string & filename,
Idx line,
Idx col )

Adds a warning.

Parameters
msgThe warning's message.
filenameThe warning's file.
lineThe warning's line.
colThe warning's column.

Definition at line 89 of file errorsContainer_inl.h.

92 {
93 add(ParseError(false, msg, filename, line, col));
94 }

References add().

Here is the call graph for this function:

◆ count()

INLINE Size gum::ErrorsContainer::count ( ) const

Returns the number of errors and warnings.

Returns
Returns the number of errors and warnings.

Definition at line 102 of file errorsContainer_inl.h.

102{ return error_count + warning_count; }

References error_count, and warning_count.

◆ elegantErrors()

void gum::ErrorsContainer::elegantErrors ( std::ostream & o) const

Print errors on output stream.

Parameters
oThe output strem to send results.

◆ elegantErrorsAndWarnings()

void gum::ErrorsContainer::elegantErrorsAndWarnings ( std::ostream & o) const

Print errors on output stream.

Parameters
oThe output strem to send results.

◆ Error()

INLINE void gum::ErrorsContainer::Error ( const std::wstring & filename,
Idx line,
Idx col,
const wchar_t * msg )

For adding errors.

Parameters
filenameThe error's file.
lineThe error's line.
colThe error's column.
msgThe error's message.

Definition at line 55 of file errorsContainer_inl.h.

55 {
56 add(ParseError(true, narrow(std::wstring(msg)), narrow(filename), line, col));
57 }
std::string narrow(const std::wstring &str)
Cast a std::wstring into a std::string.

References add(), and narrow().

Here is the call graph for this function:

◆ error()

ParseError gum::ErrorsContainer::error ( Idx i) const

Returns the i-th error.

Parameters
iThe error to return.
Returns
Returns the i-th error.
Exceptions
OutOfBoundsRaised if there is less than i errors.

Referenced by ErrorsContainer(), and add().

Here is the caller graph for this function:

◆ Exception()

INLINE void gum::ErrorsContainer::Exception ( const std::wstring & filename,
const wchar_t * msg )

For adding exceptions.

Parameters
filenameThe exception's file.
msgThe exception's message.

Definition at line 68 of file errorsContainer_inl.h.

68 {
69 add(ParseError(true, "Exception : " + narrow(std::wstring(msg)), narrow(filename), 0, 0));
70 }

References add(), and narrow().

Here is the call graph for this function:

◆ last()

ParseError gum::ErrorsContainer::last ( ) const

Returns the last added error.

Returns
Returns the last added error.
Exceptions
OutOfBoundsRaised if is no error to return.

◆ operator+()

ErrorsContainer gum::ErrorsContainer::operator+ ( const ErrorsContainer & cont) const

Return the sum of two gum::ErrorsContainer.

Parameters
contThe gum::ErrorsContainer to add.
Returns
Return the sum of two gum::ErrorsContainer.

References ErrorsContainer().

Here is the call graph for this function:

◆ operator+=()

ErrorsContainer gum::ErrorsContainer::operator+= ( const ErrorsContainer & cont)

Add the content of a gum::ErrorsContainer to this gum::ErrorsContainer.

Parameters
contThe gum::ErrorsContainer to add to this.
Returns
Returns this gum::ErrorsContainer.

References ErrorsContainer().

Here is the call graph for this function:

◆ operator=()

ErrorsContainer gum::ErrorsContainer::operator= ( const ErrorsContainer & cont)

Copy Operator.

Parameters
contThe gum::ErrorsContainer to copy.
Returns
Returns this gum::ErrorsContainer.

References ErrorsContainer().

Here is the call graph for this function:

◆ simpleErrors()

void gum::ErrorsContainer::simpleErrors ( std::ostream & o) const

Print errors on output stream.

Parameters
oThe output strem to send results.

◆ simpleErrorsAndWarnings()

void gum::ErrorsContainer::simpleErrorsAndWarnings ( std::ostream & o) const

Print errors on output stream.

Parameters
oThe output strem to send results.

◆ syntheticResults()

INLINE void gum::ErrorsContainer::syntheticResults ( std::ostream & o) const

Print errors on output stream.

Parameters
oThe output strem to send results.

Definition at line 105 of file errorsContainer_inl.h.

105 {
106 o << "Errors : " << error_count << std::endl;
107 o << "Warnings : " << warning_count << std::endl;
108 }

References error_count, and warning_count.

◆ Warning()

INLINE void gum::ErrorsContainer::Warning ( const std::wstring & filename,
Idx line,
Idx col,
const wchar_t * msg )

For adding warnings.

Parameters
filenameThe warning's file.
lineThe warning's line.
colThe warning's column.
msgThe warning's message.

Definition at line 60 of file errorsContainer_inl.h.

63 {
64 add(ParseError(false, narrow(std::wstring(msg)), narrow(filename), line, col));
65 }

References add(), and narrow().

Here is the call graph for this function:

Member Data Documentation

◆ error_count

Size gum::ErrorsContainer::error_count

Number of errors detected.

Definition at line 186 of file errorsContainer.h.

Referenced by add(), count(), and syntheticResults().

◆ errors

std::vector< ParseError > gum::ErrorsContainer::errors
mutableprivate

The list of gum::ParseError contained in this gum::ErrorsContainer.

Definition at line 182 of file errorsContainer.h.

Referenced by add().

◆ warning_count

Size gum::ErrorsContainer::warning_count

Definition at line 189 of file errorsContainer.h.

Referenced by add(), count(), and syntheticResults().


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