00001 #ifndef INCLUDE_LORISEXCEPTION_PI_H 00002 #define INCLUDE_LORISEXCEPTION_PI_H 00003 /* 00004 * This is the Loris C++ Class Library, implementing analysis, 00005 * manipulation, and synthesis of digitized sounds using the Reassigned 00006 * Bandwidth-Enhanced Additive Sound Model. 00007 * 00008 * Loris is Copyright (c) 1999-2010 by Kelly Fitz and Lippold Haken 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY, without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 * 00024 * 00025 * lorisException_pi.h 00026 * 00027 * A component of the C-linkable procedural interface for Loris. 00028 * 00029 * Main components of the Loris procedural interface: 00030 * - object interfaces - Analyzer, Synthesizer, Partial, PartialIterator, 00031 * PartialList, PartialListIterator, Breakpoint, BreakpointEnvelope, 00032 * and SampleVector need to be (opaque) objects in the interface, 00033 * either because they hold state (e.g. Analyzer) or because they are 00034 * fundamental data types (e.g. Partial), so they need a procedural 00035 * interface to their member functions. All these things need to be 00036 * opaque pointers for the benefit of C. 00037 * - non-object-based procedures - other classes in Loris are not so stateful, 00038 * and have sufficiently narrow functionality that they need only 00039 * procedures, and no object representation. 00040 * - utility functions - some procedures that are generally useful but are 00041 * not yet part of the Loris core are also defined. 00042 * - notification and exception handlers - all exceptions must be caught and 00043 * handled internally, clients can specify an exception handler and 00044 * a notification function (the default one in Loris uses printf()). 00045 * 00046 * This file declares the exception handling functions used in the 00047 * Loris procedural interface. 00048 * 00049 * Kelly Fitz, 10 Nov 2000 00050 * loris@cerlsoundgroup.org 00051 * 00052 * http://www.cerlsoundgroup.org/Loris/ 00053 * 00054 */ 00055 00056 #include "LorisExceptions.h" 00057 #include <string> 00058 00059 // forward-declare local exception handler: 00060 void handleException( const char * s ); 00061 00062 /* ---------------------------------------------------------------- */ 00063 /* class NullPointer 00064 /* 00065 /* Exception subclass for catching NULL pointers: 00066 */ 00067 class NullPointer : public Loris::Exception 00068 { 00069 public: 00070 NullPointer( const std::string & str, const std::string & where = "" ) : 00071 Exception( std::string("NULL pointer exception -- ").append( str ), where ) {} 00072 }; // end of class NullPointer 00073 00074 #define ThrowIfNull(ptr) if ((ptr)==NULL) Throw( NullPointer, #ptr ); 00075 00076 00077 #endif /* ndef INCLUDE_LORISEXCEPTION_PI_H */