NOMAD Source  Version 4.0.0 Beta
Exception Class Reference

Exception utility. More...

#include <Exception.hpp>

Inheritance diagram for Exception:
Collaboration diagram for Exception:

Public Member Functions

 Exception (size_t line, const std::string &msg)
 
virtual ~Exception (void)
 Destructor. More...
 
const char * what (void) const noexcept
 Access to the error message. More...
 
size_t getLineNumber (void) const noexcept
 
 Exception (const std::string &file, const size_t line, const std::string &msg)
 Constructor. More...
 
virtual ~Exception () throw ()
 Destructor. More...
 
const char * what () const throw ()
 Access to the error message. More...
 

Protected Attributes

std::string _typeMsg
 Basic exception message indicating the type of exception. More...
 

Private Attributes

std::string _what
 Error message. More...
 
size_t _line
 Line number at which the exception is thrown. More...
 
std::string _file
 File where the exception is thrown. More...
 

Detailed Description

Exception utility.

Custom class for exceptions.

NOMAD uses this type of exceptions. It indicates the file and line number at which a throw is made.

Example

throw Exception(__FILE__, __LINE__, "an error message");

Definition at line 86 of file WriteAttributeDefinitionFile.cpp.

Constructor & Destructor Documentation

◆ Exception() [1/2]

Exception::Exception ( size_t  line,
const std::string &  msg 
)
inline

Definition at line 96 of file WriteAttributeDefinitionFile.cpp.

97  : _what ( msg ) ,
98  _line ( line ) {}

◆ ~Exception() [1/2]

virtual Exception::~Exception ( void  )
inlinevirtual

Destructor.

Definition at line 101 of file WriteAttributeDefinitionFile.cpp.

101 {}

◆ Exception() [2/2]

Exception::Exception ( const std::string &  file,
const size_t  line,
const std::string &  msg 
)
inline

Constructor.

Parameters
fileA string corresponding to the file where the exception is thrown – IN
lineAn integer corresponding to the line number at which the exception is thrown – IN.
msgA string corresponding to the error message – IN.

Definition at line 93 of file Exception.hpp.

94  : _what(msg),
95  _file(file),
96  _line(line),
97  _typeMsg("")
98  {}

◆ ~Exception() [2/2]

virtual Exception::~Exception ( )
throw (
)
inlinevirtual

Destructor.

Definition at line 101 of file Exception.hpp.

101 {}

Member Function Documentation

◆ getLineNumber()

size_t Exception::getLineNumber ( void  ) const
inlinenoexcept

Definition at line 108 of file WriteAttributeDefinitionFile.cpp.

108 { return _line; }

◆ what() [1/2]

const char* Exception::what ( ) const
throw (
)

Access to the error message.

Returns
A string with the error message.

◆ what() [2/2]

const char* Exception::what ( void  ) const
inlinenoexcept

Access to the error message.

Returns
A string with the error message.

Definition at line 107 of file WriteAttributeDefinitionFile.cpp.

107 { return _what.c_str(); }

Member Data Documentation

◆ _file

std::string Exception::_file
private

File where the exception is thrown.

Definition at line 77 of file Exception.hpp.

◆ _line

size_t Exception::_line
private

Line number at which the exception is thrown.

Definition at line 92 of file WriteAttributeDefinitionFile.cpp.

◆ _typeMsg

std::string Exception::_typeMsg
protected

Basic exception message indicating the type of exception.

Definition at line 81 of file Exception.hpp.

◆ _what

std::string Exception::_what
mutableprivate

Error message.

Definition at line 91 of file WriteAttributeDefinitionFile.cpp.


The documentation for this class was generated from the following files:
Exception::Exception
Exception(size_t line, const std::string &msg)
Definition: WriteAttributeDefinitionFile.cpp:96
Exception::_typeMsg
std::string _typeMsg
Basic exception message indicating the type of exception.
Definition: Exception.hpp:81
Exception::_line
size_t _line
Line number at which the exception is thrown.
Definition: WriteAttributeDefinitionFile.cpp:92
Exception::_what
std::string _what
Error message.
Definition: WriteAttributeDefinitionFile.cpp:91
Exception::_file
std::string _file
File where the exception is thrown.
Definition: Exception.hpp:77