Uniform handling of errors is provided by the
Error class. The Error class provides four static methods, summarized in table
3-1. From within a star definition, it is not necessary to explicitly include the Error.h header file. A typical use of the class is shown below:
Error::abortRun(*this,"this message is displayed");
The notation "Error::abortRun" is the way
static methods are invoked in C++ without having a pointer to an instance of the Error class. The first argument tells the error class which object is flagging the error; this is strongly recommended. The name of the object will be printed along with the error message. Note that the abortRun call does not cause an immediate halt. It simply marks a flag that the scheduler must test for.
The table uses standard C++ notation to indicate how to use the methods. The type of the return value and the type of the arguments is given, together with an explanation of each. When an argument has the annotation "= something," then this argument is optional. If it is omitted from the call, then the value used will be something.
TABLE 3-1: A summary of the static methods in the Error class. Each method has two templates, as shown only for the abortRun method. The others are the same.
ptolemy@eecs.berkeley.edu
Copyright © 1990-1997, University of California. All rights
reserved.