NOMAD Source  Version 4.0.0 Beta
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 (void) throw ()
 Destructor. More...
 
const char * what (void) const throw ()
 Access to the error message. 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 37 of file WriteAttributeDefinitionFile.cpp.

Constructor & Destructor Documentation

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

Definition at line 47 of file WriteAttributeDefinitionFile.cpp.

48  : _what ( msg ) ,
49  _line ( line ) {}
std::string _what
Error message.
size_t _line
Line number at which the exception is thrown.
virtual Exception::~Exception ( void  )
inlinevirtual

Destructor.

Definition at line 52 of file WriteAttributeDefinitionFile.cpp.

52 {}
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 45 of file Exception.hpp.

46  : _what ( msg ) ,
47  _file ( file ) ,
48  _line ( line ) {}
std::string _file
File where the exception is thrown.
Definition: Exception.hpp:32
std::string _what
Error message.
size_t _line
Line number at which the exception is thrown.
virtual Exception::~Exception ( void  )
throw (
)
inlinevirtual

Destructor.

Definition at line 51 of file Exception.hpp.

51 {}

Member Function Documentation

size_t Exception::getLineNumber ( void  ) const
inlinenoexcept

Definition at line 59 of file WriteAttributeDefinitionFile.cpp.

59 { return _line; }
size_t _line
Line number at which the exception is thrown.
const char* Exception::what ( void  ) const
throw (
)

Access to the error message.

Returns
A string with the error message.
const char* Exception::what ( void  ) const
inlinenoexcept

Access to the error message.

Returns
A string with the error message.

Definition at line 58 of file WriteAttributeDefinitionFile.cpp.

58 { return _what.c_str(); }
std::string _what
Error message.

Member Data Documentation

std::string Exception::_file
private

File where the exception is thrown.

Definition at line 32 of file Exception.hpp.

size_t Exception::_line
private

Line number at which the exception is thrown.

Definition at line 43 of file WriteAttributeDefinitionFile.cpp.

std::string Exception::_what
mutableprivate

Error message.

Definition at line 42 of file WriteAttributeDefinitionFile.cpp.


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