University of Sheffield   

    The Simons
    Component Library

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

NoElements Class Reference

#include <NoElements.h>

Inheritance diagram for NoElements:

MethodError Exception Object List of all members.

Detailed Description

NoElements: signals a failed attempt to extract an element.

Raise a NoElements exception if an attempt is made to extract an element from an empty Collection. Similar dispensing containers may also raise this exception. NoElements provides access to the failed object(), the error message(), the failed method() and a default element(). Typically, a NoElements exception indicates a semantic failure in a program which tried to retrieve more elements than it stored, so is treated as fatal. However, certain dispensing programs may wish to recover. These should supply a default element when the NoElements exception is raised. This element may be cloned during recovery and used in place of the missing element.


Public Member Functions

 NoElements ()
 Construct a default NoElements.

virtual ~NoElements ()
 Release a NoElements.

 NoElements (ObjectID, StringID)
 Construct a NoElements exception.

 NoElements (ObjectID, StringID, ObjectID)
 Construct a NoElements exception, supplying a default element.

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

ObjectID element () const
 Access the default element.


Protected Member Functions

 NoElements (const NoElements &)
 Copy another NoElements.


Protected Attributes

ObjectID defaultElement
 A default element, or null.


Constructor & Destructor Documentation

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

Copy another NoElements.

Required by C++ to ensure that copying an NoElements faithfully copies a MethodError.

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

NoElements::NoElements  ) 
 

Construct a default NoElements.

Returns:
a NoElements

NoElements::~NoElements  )  [virtual]
 

Release a NoElements.

NoElements::NoElements ObjectID  object,
StringID  method
 

Construct a NoElements exception.

Raised when an attempt is made to access an element of an empty Collection. May also be raised by other kinds of dispensing container, when they run out of elements. The default element is set to null.

Parameters:
object - the object on which element access failed.
method - the name of the failed method.
Returns:
a NoElements exception.

NoElements::NoElements ObjectID  object,
StringID  method,
ObjectID  element
 

Construct a NoElements exception, supplying a default element.

Raised when an attempt is made to access an element from a fail-safe dispensing container, when this becomes empty. During recovery, the default element may be used directly, or cloned by the program.

Parameters:
object - the object on which element access failed.
method - the name of the failed method.
element - a default element to use instead.
Returns:
a NoElements exception.


Member Function Documentation

ObjectID NoElements::clone  )  const [virtual]
 

Clone a shallow copy of this NoElements.

Returns:
a NoElements exception, a shallow copy.

Reimplemented from Exception.

ObjectID NoElements::element  )  const [inline]
 

Access the default element.

Returns:
the default element.


Member Data Documentation

ObjectID NoElements::defaultElement [protected]
 

A default element, or null.


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