CException

Name

CException -- Abstract base class for the exception class hierarchy.

Synopsis


#include <Exception.h>
class         CException {
                
  CException(const char* pszAction);
                  CException(const std::string& rsAction);
                
  virtual const  const char* ReasonText();
                  virtual const Int_t ReasonCode();
                  const const char* WasDoing();
};
               

Description

This class is the abstract base class of the exception class hierarchy. The class hierarchy provides textual exception descriptions (that can be displayed to a user), as well as support for a numerical code that can be easily processed by software. The textual description is composed by the ReasonText function in an exception specific way. Usually the resulting message includes a description of the message along with context information held by this base class and retrieved via WasDoing.

Public member functions

CException(const char* pszAction); CException(const std::string& rsAction);

Both of the constructors described above save their parameter as the context specific part of the description. This string can be retrieved via WasDoing. Normally the string should give some indication of what the program was doing when the exception was thrown.

virtual const const char* ReasonText();

A virtual function that is supposed to return the reason the exception was thrown. For the base class this is the string Unspecified Exception.

virtual const Int_t ReasonCode ();

Returns a number that corresponds to the exception reason within a specific class of exceptions (e.g. for a CErrnoException this would be the value of errno at the time the exception was constructed). For the base class this will always be -1.

const const char* WasDoing();

Returns the context string that was passed to our constructor. This will normally be called by a derived class's ReasonText function when constructing the text.