GEOS
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
geos::ErrorContext Struct Reference

#include <ErrorHandling.hpp>

Public Types

enum class  Attribute {
  InputFile , InputLine , DataPath , DetectionLoc ,
  Signal
}
 

Public Member Functions

 ErrorContext (string formattedContext, map< Attribute, std::string > attributes)
 Construct to initialize ErrorContext. More...
 
 ErrorContext (string formattedContext, map< Attribute, std::string > attributes, integer priority)
 Construct to initialize ErrorContext given a string containing the context and his priority. More...
 
ErrorContextsetPriority (integer priority)
 Set the priority value of the current error context information. This way the different context information will appear in descending order during the error log output. More...
 

Static Public Member Functions

static std::string attributeToString (Attribute attribute)
 Convert a value from the Attribute enumeration to a string. More...
 

Public Attributes

string m_formattedContext
 String containing the target object name followed by the the file and line declaring it.
 
map< Attribute, std::string > m_attributes
 The map contains contextual information about the error It could be something like "file" = "/path/to/file.xml" "line" = "24" or something like "dataPath" = "/Functions/co2brine_philipsDensityTable The key is a field of the Attribute enumeration and is converted to a string for writing in the YAML.
 
integer m_priority = 0
 Priority level assigned to an error context. More...
 

Detailed Description

Store contextual information about the error that occurred and assign it a priority default is 0

Definition at line 36 of file ErrorHandling.hpp.

Member Enumeration Documentation

◆ Attribute

Enumeration used to secure potential map keys

Definition at line 43 of file ErrorHandling.hpp.

Constructor & Destructor Documentation

◆ ErrorContext() [1/2]

geos::ErrorContext::ErrorContext ( string  formattedContext,
map< Attribute, std::string >  attributes 
)
inline

Construct to initialize ErrorContext.

Parameters
formattedContextString containing the target object name followed by the the file and line declaring it.
attributesMap containing contextual information about the error

Definition at line 77 of file ErrorHandling.hpp.

◆ ErrorContext() [2/2]

geos::ErrorContext::ErrorContext ( string  formattedContext,
map< Attribute, std::string >  attributes,
integer  priority 
)
inline

Construct to initialize ErrorContext given a string containing the context and his priority.

Parameters
formattedContextString containing the target object name followed by the the file and line declaring it.
attributesMap containing contextual information about the error
priorityPriority level assigned to an error context.

Definition at line 87 of file ErrorHandling.hpp.

Member Function Documentation

◆ attributeToString()

static std::string geos::ErrorContext::attributeToString ( Attribute  attribute)
static

Convert a value from the Attribute enumeration to a string.

Parameters
attributethe value of the enumeration to be converted
Returns
a string representation of the enumeration value

◆ setPriority()

ErrorContext& geos::ErrorContext::setPriority ( integer  priority)
inline

Set the priority value of the current error context information. This way the different context information will appear in descending order during the error log output.

Parameters
prioritythe new value to asign
Returns
the reference to the corresponding error

Definition at line 98 of file ErrorHandling.hpp.

Member Data Documentation

◆ m_priority

integer geos::ErrorContext::m_priority = 0

Priority level assigned to an error context.

Used to prioritize contexts (higher values = more relevant). Default is 0.

Definition at line 70 of file ErrorHandling.hpp.


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