University of Sheffield   

    The Simons
    Component Library

Introduction   Class Hierarchy   Class Listing   Index of Classes   Index of Methods   Header Files  

NullPointer Class Reference

#include <NullPointer.h>

Inheritance diagram for NullPointer:

ObjectError Exception Object List of all members.

Detailed Description

NullPointer: signals attempted access to a null object reference.

Raise a NullPointer exception if an ObjectID variable is uninitialised and the program expects it to contain a valid Object reference. The most common cause of a NullPointer exception is by accidentally invoking a method on a null reference. Client programs may also raise explicit NullPointer exceptions for uninitialised variables. NullPointer provides methods to access the failed object(), the message() and the expectedType(). If the failed object is null, the system raised this NullPointer exception, otherwise the object raised it. Typically, a NullPointer exception is meant to be fatal. However, it may sometimes be handled by creating a default instance of the expected Type and using this object instead.


Public Member Functions

 NullPointer ()
 Construct a default NullPointer.

virtual ~NullPointer ()
 Release a NullPointer.

 NullPointer (ObjectID, TypeID)
 Construct a NullPointer exception, with the expected Type.

 NullPointer (ObjectID, ObjectID)
 Construct a NullPointer exception, with an exemplar Object.

virtual ObjectID clone () const
 Clone a shallow copy of this NullPointer.


Protected Member Functions

 NullPointer (const NullPointer &)
 Copy another NullPointer.


Constructor & Destructor Documentation

NullPointer::NullPointer const NullPointer &  exception  )  [protected]
 

Copy another NullPointer.

Required by C++ to ensure that copying an NullPointer faithfully copies an ObjectError.

Parameters:
exception - the NullPointer to copy.
Returns:
a NullPointer, a shallow copy.

NullPointer::NullPointer  ) 
 

Construct a default NullPointer.

Returns:
a NullPointer

NullPointer::~NullPointer  )  [virtual]
 

Release a NullPointer.

NullPointer::NullPointer ObjectID  object,
TypeID  type
 

Construct a NullPointer exception, with the expected Type.

Raised by client programs to signal that an unexpected null reference was detected in some Object, instead of an instance of the expected Type. Sets the expected Type. Recovery is not guaranteed; and depends on which default objects are currently registered with Type.

Parameters:
object - the object in which the null reference was detected.
type - the Type of object that was expected in the variable.
Returns:
a NullPointer exception.

NullPointer::NullPointer ObjectID  object,
ObjectID  exemplar
 

Construct a NullPointer exception, with an exemplar Object.

Raised automatically whenever an attempt is made to invoke a method on a null reference. Sets the expected Type. Recovery is always possible, since the exemplar is registered with Type. NOTE: recovering from this exception is safe, provided that your C++ compiler correctly deallocates method arguments on the execution stack, since this exception is raised partway through method invocation. (This can be checked by turning on the build-option to view all reference counts).

Parameters:
object - null, indicating that the system detected the failure.
exemplar - a default instance of the expected Type.
Returns:
a NullPointer exception.


Member Function Documentation

ObjectID NullPointer::clone  )  const [virtual]
 

Clone a shallow copy of this NullPointer.

Returns:
a NullPointer exception, a shallow copy.

Reimplemented from Exception.


The documentation for this class was generated from the following files:
Generated on Fri May 5 17:17:18 2006 for The Simons Component Library by doxygen1.3