FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
Exception::FMTWarning Class Reference

Exception class derived from FMTException for warnings in FMT. More...

#include <FMTWarning.h>

Inheritance diagram for Exception::FMTWarning:
[legend]
Collaboration diagram for Exception::FMTWarning:
[legend]

Public Member Functions

 ~FMTWarning ()=default
 Default destructor for FMTWarning.
 
FMTWarningoperator= (const FMTWarning &)=default
 Default copy assignment operator for FMTWarning.
 
 FMTWarning ()
 Default constructor for FMTWarning.
 
 FMTWarning (FMTexc p_exception, Core::FMTsection p_section, const std::string &p_message, const std::string &p_method, const std::string &p_file, const int &p_line, const std::string &p_FrenchDescription, const std::string &p_EnglishDescription)
 Construct a FMTWarning from an exception type, a section, a message and the location where it occurred.
 
void warn (Logging::FMTLogger &logger, std::unordered_map< int, size_t > &specificwarningcount, const size_t &maxwarning) const
 Log the warning using the given logger.
 
- Public Member Functions inherited from Exception::FMTException
 FMTException ()
 Default constructor for FMTException.
 
virtual ~FMTException ()=default
 Default virtual destructor for FMTException.
 
 FMTException (FMTexc p_exception, FMTlev p_level, Core::FMTsection p_section, const std::string &p_message, const std::string &p_method, const std::string &p_file, const int &p_line, const std::string &p_FrenchDescription, const std::string &p_EnglishDescription)
 Construct a FMTException from an exception type, a section, a message and the location where it occurred.
 
 FMTException (const FMTException &rhs)=default
 Default copy constructor for FMTException.
 
FMTExceptionoperator= (const FMTException &rhs)=default
 Default copy assignment operator for FMTException.
 
FMTexc getType () const
 Return the type of exception held by this FMTException.
 
Core::FMTsection getSection () const
 Return the section in which the exception occurred.
 
const char * what () const noexcept override
 Override the what function of the base exception class returning the message string.
 
bool hold () const
 Return the value of the holdup member.
 
void setHold (bool side)
 Set the value of the holdup member.
 
std::string getMethod () const
 Return the method in which the exception occurred.
 
std::string getFile () const
 Return the source file in which the exception occurred.
 
int getLine () const
 Return the source file line in which the exception occurred.
 
const std::string & getDescription (bool p_french=false) const
 Return the description of the exception thrown.
 
std::string getSrcInfo () const
 Return a formatted string for the location of the exception.
 
const std::string & getMessage () const
 Return the message of the exception.
 
FMTlev getLevel () const
 Return the level of the exception.
 
bool isFatal () const
 return true if it is fatal
 
void setIgnore ()
 set a ignore message to the exception and turn the level to warning
 
void setPrintLevel (int p_level)
 set the level of print and change the message
 

Friends

class boost::serialization::access
 Serialize the FMTWarning through its base FMTException for multiprocessing across multiple cpus (pickle in Python).
 

Detailed Description

Exception class derived from FMTException for warnings in FMT.

See FMTException for more information about the member data. Warnings are never thrown but only logged depending on the FMTLogger and FMTExceptionHandler used.

Constructor & Destructor Documentation

◆ ~FMTWarning()

Exception::FMTWarning::~FMTWarning ( )
default

Default destructor for FMTWarning.

◆ FMTWarning() [1/2]

Exception::FMTWarning::FMTWarning ( )

Default constructor for FMTWarning.

◆ FMTWarning() [2/2]

Exception::FMTWarning::FMTWarning ( FMTexc  p_exception,
Core::FMTsection  p_section,
const std::string &  p_message,
const std::string &  p_method,
const std::string &  p_file,
const int &  p_line,
const std::string &  p_FrenchDescription,
const std::string &  p_EnglishDescription 
)

Construct a FMTWarning from an exception type, a section, a message and the location where it occurred.

Parameters
[in]p_exceptionthe exception type.
[in]p_sectionthe section in which the exception occurred.
[in]p_messagethe message of the exception.
[in]p_methodthe method where the exception occurred.
[in]p_filethe file where the exception occurred.
[in]p_linethe line where the exception occurred.
[in]p_FrenchDescriptionfrench description.
[in]p_EnglishDescriptionenglish description.

Member Function Documentation

◆ operator=()

FMTWarning & Exception::FMTWarning::operator= ( const FMTWarning )
default

Default copy assignment operator for FMTWarning.

Returns
a reference to this FMTWarning.

◆ warn()

void Exception::FMTWarning::warn ( Logging::FMTLogger logger,
std::unordered_map< int, size_t > &  specificwarningcount,
const size_t &  maxwarning 
) const

Log the warning using the given logger.

Parameters
[in,out]loggerthe logger used to log the warning.
[in,out]specificwarningcountthe count of each specific warning already logged.
[in]maxwarningthe maximum number of times a warning is logged.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Serialize the FMTWarning through its base FMTException for multiprocessing across multiple cpus (pickle in Python).

Template Parameters
Archivethe archive type.
Parameters
[in,out]arthe archive to serialize to or from.
[in]versionthe serialization version.

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