00001 // SuperMix version 1.0 C++ source file 00002 // 00003 // Copyright (c) 1999 California Institute of Technology. 00004 // All rights reserved. 00005 // 00006 // Redistribution and use in source and binary forms for noncommercial 00007 // purposes are permitted provided that the above copyright notice and 00008 // this paragraph are duplicated in all such forms and that any 00009 // documentation and other materials related to such distribution and 00010 // use acknowledge that the software was developed by California 00011 // Institute of Technology. Redistribution and/or use in source or 00012 // binary forms is not permitted for any commercial purpose. Use of 00013 // this software does not include a permitted use of the Institute's 00014 // name or trademark for any purpose. 00015 // 00016 // DISCLAIMER: 00017 // THIS SOFTWARE AND/OR RELATED MATERIALS ARE PROVIDED "AS-IS" WITHOUT 00018 // WARRANTY OF ANY KIND INCLUDING ANY WARRANTIES OF PERFORMANCE OR 00019 // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE OR PURPOSE (AS SET 00020 // FORTH IN UCC 23212-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE 00021 // LICENSED PRODUCT, HOWEVER USED. IN NO EVENT SHALL CALTECH/JPL BE 00022 // LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING BUT NOT LIMITED TO 00023 // INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, INCLUDING ECONOMIC 00024 // DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, REGARDLESS OF 00025 // WHETHER CALTECH/JPL SHALL BE ADVISED, HAVE REASON TO KNOW, OR IN 00026 // FACT SHALL KNOW OF THE POSSIBILITY. THE USER BEARS ALL RISK 00027 // RELATING TO QUALITY AND PERFORMANCE OF THE SOFTWARE AND/OR RELATED 00028 // MATERIALS. 00029 // 00030 // ************************************************************* 00031 // 00032 // error.cc 00033 // 00034 // Change history: 00035 // 00036 // 9/16/99: Added 2nd argument to function calls 00037 // 9/15/98: Added message, select output stream 00038 00039 #include "error.h" 00040 #include <iostream.h> 00041 #include <stdlib.h> 00042 00043 // static data: 00044 int error::strict = 0; 00045 int error::messages = 0; 00046 ostream *error::pout = & cerr; 00047 00048 void error::fatal(const char *e) 00049 { 00050 (*pout) << "\nFATAL ERROR: " << e << endl; 00051 exit(1); 00052 } 00053 00054 void error::fatal(const string &e) 00055 { fatal(e.c_str()); } 00056 00057 void error::fatal(const char *e, const char *f) 00058 { 00059 (*pout) << "\nFATAL ERROR: " << e << " " << f << endl; 00060 exit(1); 00061 } 00062 00063 void error::fatal(const string &e, const string &f) 00064 { fatal(e.c_str(), f.c_str()); } 00065 00066 void error::warning(const char *e) 00067 { 00068 if(strict) 00069 fatal(e); 00070 else 00071 (*pout) << "\nWARNING: " << e << endl; 00072 } 00073 00074 void error::warning(const string &e) 00075 { warning(e.c_str()); } 00076 00077 void error::warning(const char *e, const char *f) 00078 { 00079 if(strict) 00080 fatal(e,f); 00081 else 00082 (*pout) << "\nWARNING: " << e << " " << f << endl; 00083 } 00084 00085 void error::warning(const string &e, const string &f) 00086 { warning(e.c_str(), f.c_str()); } 00087 00088 void error::message(const char *e) 00089 { 00090 if(messages) 00091 (*pout) << "\nMESSAGE: " << e << endl; 00092 } 00093 00094 void error::message(const string &e) 00095 { message(e.c_str()); } 00096 00097 void error::message(const char *e, const char *f) 00098 { 00099 if(messages) 00100 (*pout) << "\nMESSAGE: " << e << " " << f << endl; 00101 } 00102 00103 void error::message(const string &e, const string &f) 00104 { message(e.c_str(), f.c_str()); }
Please direct comments and corrections to
supermix@submm.caltech.edu
Go to the supermix home page
Generated by
1.2.7