![]() |
The Simons
|
#include <TypeFailure.h>
Inheritance diagram for TypeFailure:
Raise a TypeFailure exception if the object stored in an ObjectID reference is not of the expected Type. The most common cause of a TypeFailure is when an object is transferred from a general source variable to a more specific target variable, but is not of a compatible type. Type downcasts using toType()
may raise a TypeFailure exception if the dynamic type of the Object stored in the source variable is not compatible with the expected type of the target variable. Methods that retrieve simple values from ObjectID variables may raise a TypeFailure if the variable does not contain a value of the expected type. Client programs may also choose to raise a TypeFailure exception after tentative downcasting with tryType()
has failed. TypeFailure provides methods to access the failed object(), the message(), the expectedType() and the actualType(). Typically, a TypeFailure exception is meant to be fatal. However, it may sometimes be handled by creating a default instance of the expected Type and using this instead.
Public Member Functions | |
TypeFailure () | |
Construct a default TypeFailure. | |
virtual | ~TypeFailure () |
Release an TypeFailure. | |
TypeFailure (ObjectID, TypeID) | |
Construct a TypeFailure exception, with the expected Type. | |
TypeFailure (ObjectID, ObjectID) | |
Construct a TypeFailure exception, with an exemplar Object. | |
virtual ObjectID | clone () const |
Clone a shallow copy of this TypeFailure. | |
TypeID | actualType () const |
Access the actual type of the failed Object. | |
Protected Member Functions | |
TypeFailure (const TypeFailure &) | |
Copy another TypeFailure. |
|
Copy another TypeFailure. Required by C++ to ensure that copying an TypeFailure faithfully copies an ObjectError.
|
|
Construct a default TypeFailure.
|
|
Release an TypeFailure.
|
|
Construct a TypeFailure exception, with the expected Type. Used by methods that unpack simple values from Objects, if the source and target types do not match. May also be raised explicitly by client programs. Sets the expected Type. Recovery is not guaranteed; and depends on which default objects are currently registered with Type.
|
|
Construct a TypeFailure exception, with an exemplar Object. Raised automatically whenever an attempt is made to perform a type conversion to an incompatible type. Used by toType() when the dynamic type of the source variable is not compatible with the type of the target variable. May also be raised explicitly by client programs. Sets the expected Type. Recovery may always be attempted, since the exemplar is registered with Type. However, the expected Type may be too general to create useful instances.
|
|
Access the actual type of the failed Object.
|
|
Clone a shallow copy of this TypeFailure.
Reimplemented from Exception. |