• Antelope Release 5.5 Linux 2.6.32-220.el6.x86_64 2015-04-21

 

NAME

SeisppError - error object for seispp library

SYNOPSIS

#include "SeisppError.h"
using namespace SEISPP;
class SeisppError;
class SeisppDberror : public SeisppError;
class SACdataError : public SeisppError;

SUPPORT


Contributed code: NO BRTT support.
THIS PIECE OF SOFTWARE WAS CONTRIBUTED BY THE ANTELOPE USER COMMUNITY. BRTT DISCLAIMS ALL OWNERSHIP, LIABILITY, AND SUPPORT FOR THIS PIECE OF SOFTWARE.

FOR HELP WITH THIS PIECE OF SOFTWARE, PLEASE CONTACT THE CONTRIBUTING AUTHOR.

DESCRIPTION

The seispp library is an object-oriented seismic processing library written in C++. One of the things C++ added to plain C is exceptions as a mechanism for library routines to handle problems. For Antelope users the SeisppError facility is comparable to the elog library in Antelope, but with an object oriented flavor.

The present facility is pretty basic with the base class SeisppError object being defined as follows:

class SeisppError
{
public:
        string message;
        SeisppError(){message="seispp library error\n";};
        SeisppError(const string mess){message=mess;};
        virtual void log_error(){cerr << "seispp error: "<<message<<endl;};
};

That is, a SeisppError is little more than a fancy way to return an error message through the string variable "message". The simple function "log_error" is used to post that message to the unix standard error stream.

The concept here is that more complicated error returns would be derived by inheritance from a SeisppError object. The SACdataError object is an example. It's actual definition is:

class SACdataError : public SeisppError
{
public:
        SACdataError(const string mess){message=mess;};
        virtual void log_error()
        {
                cerr<<"Error processing SAC format time series"<<endl;
                cerr<<"Error message = "<<message;
        }
};

Hence the only major difference between a SACdataError and the base class SeisppError is that the SACdataError log_error function adds an addition qualifier to the error message that is posted.

The SeisppDberror is similar except it has the constructor defined as SeisppError(string,DatabaseHandle). It prints a special message with log_error that can be used for debugging problems.

Users of this library can and should build their own derived classes from SeisppError. If more information is needed to handle different errors differently, this can be done using inheritance from SeisppError as in the examples above. e.g. an integer error code is easily placed in a derived object like SACdataError and a handler can be built around a switch-case on the error return code (a standard plain C method). For the time being this library is written with the concept that when an exception is thrown an operation failed and there is no mixed case. i.e. some errors can be treated differently than others. If you need that facility and are building on this library build a new error class to support it.

LIBRARY

-lseispp

SEE ALSO

TimeSeries(3),metadata_error(3),
http://geology.indiana.edu/pavlis/software/seispp/html/index.html

BUGS AND CAVEATS

Expect this class of error objects to expand. For now assume that seispp library functions will only throw a SeisppError exception and you have to depend on the documentation of a function to know how to handle any exception.

AUTHOR

Gary L. Pavlis
Indiana University
pavlis@indiana.edu

Antelope User Group Contributed Software
Printer icon