mimas::mimasexception Class Reference

Exception class deriving from std::exception. More...

#include <mimasexception.h>

Inheritance diagram for mimas::mimasexception:

Inheritance graph
[legend]
Collaboration diagram for mimas::mimasexception:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 mimasexception (void)
 Constructor.
 mimasexception (mimasexception &e)
 Copy constructor.
virtual ~mimasexception (void) throw ()
 Destructor.
template<typename T>
std::ostream & operator<< (const T &t)
std::ostream & operator<< (std::ostream &(*__pf)(std::ostream &))
 Interface for manipulators.
virtual const char * what (void) const throw ()
 Returns error message (not thread safe).

Protected Attributes

std::ostringstream message
 Memory-stream containing the error message.

Static Protected Attributes

static std::string temp
 Temporary to do null-termination.

Detailed Description

Exception class deriving from std::exception.

This class provides a syntax similar to output-streams for convenience. For compability with other libraries it is inheriting the class std::exception.

Here is an example how to use an instance of this class (by invoking the macro MMERROR):

    void test( int i ) throw (exception)
    {
      MMERROR( i > 0, exception, ,
               "Parameter for method test must be greater than zero (but was "
               << i << ")." );
    }
    
    int main(void)
    {
      try {
        test( -5 );
      } catch ( exception &e ) {
        cerr << e.what() << endl;
      };
      return 0;
    }
Mind that the macro uses a variable with the name _e. Make sure, that you don't use this variable-name in any of the macro-arguments!

Author:
Jan Wedekind (jan at wedesoft.de)
Date:
Mon Aug 23 14:37:05 UTC 2004

Definition at line 40 of file mimasexception.h.


Constructor & Destructor Documentation

mimas::mimasexception::mimasexception ( void   )  [inline]

Constructor.

Definition at line 44 of file mimasexception.h.

mimas::mimasexception::mimasexception ( mimasexception e  )  [inline]

Copy constructor.

Definition at line 46 of file mimasexception.h.

References message.

virtual mimas::mimasexception::~mimasexception ( void   )  throw () [inline, virtual]

Destructor.

Definition at line 49 of file mimasexception.h.


Member Function Documentation

template<typename T>
std::ostream& mimas::mimasexception::operator<< ( const T &  t  )  [inline]

Definition at line 52 of file mimasexception.h.

References message.

std::ostream& mimas::mimasexception::operator<< ( std::ostream &(*)(std::ostream &)  __pf  )  [inline]

Interface for manipulators.

Manipulators such as std::endl and std::hex use these functions in constructs like "mimasexception e; e << std::endl". For more information, see the iomanip header.

Definition at line 57 of file mimasexception.h.

References message.

virtual const char* mimas::mimasexception::what ( void   )  const throw () [inline, virtual]

Returns error message (not thread safe).

Definition at line 60 of file mimasexception.h.

References message, and temp.


Member Data Documentation

std::ostringstream mimas::mimasexception::message [protected]

Memory-stream containing the error message.

Definition at line 66 of file mimasexception.h.

Referenced by mimasexception(), operator<<(), and what().

std::string mimas::mimasexception::temp [static, protected]

Temporary to do null-termination.

The method what() requires a null-terminated string.

Definition at line 69 of file mimasexception.h.

Referenced by what().


The documentation for this class was generated from the following file:
[GNU/Linux] [Qt] [Mesa] [STL] [Lapack] [Boost] [Magick++] [Xalan-C and Xerces-C] [doxygen] [graphviz] [FFTW] [popt] [xine] [Gnuplot] [gnu-arch] [gcc] [gstreamer] [autoconf/automake/make] [freshmeat.net] [opensource.org] [sourceforge.net] [MMVL]
mimas 2.1 - Copyright Mon Oct 30 11:31:35 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...