EMAN2
Public Member Functions | Protected Attributes
EMAN::E2Exception Class Reference

E2Exception class is the parent class of all EMAN2 E2Exceptions. More...

#include <exception.h>

Inheritance diagram for EMAN::E2Exception:
Inheritance graph
[legend]
Collaboration diagram for EMAN::E2Exception:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 E2Exception (const string &file="", int line=0, const string &desc_str="", const string &objname_str="")
 Contructor.
virtual ~E2Exception () throw ()
virtual const char * what () const throw ()
 The E2Exception information.
virtual const char * name () const
 The name of this E2Exception class.

Protected Attributes

string filename
int linenum
string desc
string objname

Detailed Description

E2Exception class is the parent class of all EMAN2 E2Exceptions.

Definition at line 75 of file exception.h.


Constructor & Destructor Documentation

EMAN::E2Exception::E2Exception ( const string &  file = "",
int  line = 0,
const string &  desc_str = "",
const string &  objname_str = "" 
) [inline, explicit]

Contructor.

Parameters:
fileThe name of the file where an E2Exception is thrown.
lineThe line number in the file where the E2Exception is thrown.
desc_strE2Exception description string.
objname_strE2Exception involved object name.

Definition at line 85 of file exception.h.

                        : filename(file), linenum(line), desc(desc_str), objname(objname_str)
                {
                        // Log the message
                        stringstream ss;
                        string line_str;
                        ss << line;
                        ss >> line_str;
// We shouldn't log all exceptions, since they are frequently used intentionally, with no implied error
//                      string message = "File " + file + " line " + line_str + " description " + desc_str + " " + objname_str;
//                      LOGERR( message.c_str() );
                }
virtual EMAN::E2Exception::~E2Exception ( ) throw () [inline, virtual]

Definition at line 99 of file exception.h.

{}

Member Function Documentation

virtual const char* EMAN::E2Exception::name ( ) const [inline, virtual]
const char * E2Exception::what ( ) const throw () [virtual]

The E2Exception information.

Returns:
The E2Exception information including E2Exception location (filename, line number,function name) and description.

Definition at line 40 of file exception.cpp.

References desc, filename, EMAN::Util::int2str(), linenum, name(), and objname.

Referenced by main().

{
        string err1 = "";
        if (objname != "") {
                err1 = "error with '" + objname + "': ";
        }

        string msg = string(name()) + " at " + filename + ":" + Util::int2str(linenum);
        msg += ": " + err1 + "'" + desc + "' caught\n";
        return msg.c_str();
}

Member Data Documentation

string EMAN::E2Exception::desc [protected]
string EMAN::E2Exception::filename [protected]

Definition at line 113 of file exception.h.

Referenced by what().

int EMAN::E2Exception::linenum [protected]

Definition at line 114 of file exception.h.

Referenced by what().

string EMAN::E2Exception::objname [protected]

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