An Implementation of the Marching Cubes Algorithm  1.0
common::ExceptionObject Class Reference

This class extends the class exception of STL, providing a customized way of dealing with exceptions. More...

#include <exceptionobject.hpp>

List of all members.

Public Member Functions

 ExceptionObject (const char *file="Unknown", unsigned int line=0, const char *desc="None")
 Creates an instance of this class.
 ExceptionObject (const std::string &file, unsigned int line, const std::string &desc="None")
 Creates an instance of this class.
 ExceptionObject (const ExceptionObject &xpt)
 Creates an instance of this class from another instance of this class.
virtual ~ExceptionObject () throw ()
 Destroys an instance of this class.
ExceptionObjectoperator= (const ExceptionObject &xpt)
 Copies the state of a given exception to this exception.
virtual const char * get_name_of_class () const
 Gets the name of this class.
virtual void set_description (const std::string &s)
 Assigns a description to this exception.
virtual void set_description (const char *s)
 Assigns a description to this exception.
virtual const char * get_description () const
 Gets the description of this exception.
virtual const char * get_file () const
 Gets the name of the file containing the code that threw the exception.
virtual unsigned int get_line () const
 Gets the number of the line that threw the exception.
virtual const char * what () const throw ()
 Gets a description for the exception.

Private Attributes

std::string _desc
 Description of the error.
std::string _file
 File where the error occured.
unsigned int _line
 Line of the file where the error occured.

Detailed Description

This class extends the class exception of STL, providing a customized way of dealing with exceptions.

Definition at line 70 of file exceptionobject.hpp.


Constructor & Destructor Documentation

common::ExceptionObject::ExceptionObject ( const char *  file = "Unknown",
unsigned int  line = 0,
const char *  desc = "None" 
) [inline]

Creates an instance of this class.

Parameters:
fileA file with the code that threw the exception.
lineThe number of line (in the file) that threw the exception.
descA description of the exception.

Definition at line 88 of file exceptionobject.hpp.

References _desc, _file, and _line.

    {
      _file = file ;
      _desc = desc ;
      _line = line ;
    }
common::ExceptionObject::ExceptionObject ( const std::string &  file,
unsigned int  line,
const std::string &  desc = "None" 
) [inline]

Creates an instance of this class.

Parameters:
fileA file with the code that threw the exception.
lineThe number of line (in the file) that threw the exception.
descA description of the exception.

Definition at line 110 of file exceptionobject.hpp.

References _desc, _file, and _line.

    {
      _file = file ;
      _desc = desc ;
      _line = line ;
    }

Creates an instance of this class from another instance of this class.

Parameters:
xptAnother instance of this class.

Definition at line 130 of file exceptionobject.hpp.

References _desc, _file, and _line.

                                                  : exception()
    {
      _file = xpt._file ;
      _desc = xpt._desc ;
      _line = xpt._line ;
    }

Member Function Documentation

const char * common::ExceptionObject::get_description ( ) const [inline, virtual]

Gets the description of this exception.

Returns:
The description of this exception.

Definition at line 211 of file exceptionobject.hpp.

References _desc.

    { 
      return _desc.c_str() ;
    }
const char * common::ExceptionObject::get_file ( ) const [inline, virtual]

Gets the name of the file containing the code that threw the exception.

Returns:
The name of the file containing the code that threw the exception.

Definition at line 226 of file exceptionobject.hpp.

References _file.

    { 
      return _file.c_str() ;
    }
unsigned int common::ExceptionObject::get_line ( ) const [inline, virtual]

Gets the number of the line that threw the exception.

Returns:
The number of the line that threw the exception.

Definition at line 239 of file exceptionobject.hpp.

References _line.

    {
      return _line ;
    }
const char * common::ExceptionObject::get_name_of_class ( ) const [inline, virtual]

Gets the name of this class.

Returns:
The name of this class.

Definition at line 172 of file exceptionobject.hpp.

    {
      return "ExceptionObject" ;
    }
ExceptionObject & common::ExceptionObject::operator= ( const ExceptionObject xpt) [inline]

Copies the state of a given exception to this exception.

Parameters:
xptA given exception.

Definition at line 155 of file exceptionobject.hpp.

References _desc, _file, and _line.

    {
      _desc = xpt._desc ;
      _file = xpt._file ;
      _line = xpt._line ;
      
      return *this ;
    }
void common::ExceptionObject::set_description ( const std::string &  s) [inline, virtual]

Assigns a description to this exception.

Parameters:
sA string containing an exception description.

Definition at line 185 of file exceptionobject.hpp.

References _desc.

    { 
      _desc = s ; 
    }
void common::ExceptionObject::set_description ( const char *  s) [inline, virtual]

Assigns a description to this exception.

Parameters:
sA string containing an exception description.

Definition at line 198 of file exceptionobject.hpp.

References _desc.

    { 
      _desc = s ; 
    }
const char * common::ExceptionObject::what ( ) const throw () [inline, virtual]

Gets a description for the exception.

Returns:
A description for the exception.

Definition at line 252 of file exceptionobject.hpp.

References _desc.

    { 
      return _desc.c_str() ;
    }

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