ErrorHandler.cppGo to the documentation of this file.00001 /* ****************************************************************** ** 00002 ** OpenSees - Open System for Earthquake Engineering Simulation ** 00003 ** Pacific Earthquake Engineering Research Center ** 00004 ** ** 00005 ** ** 00006 ** (C) Copyright 1999, The Regents of the University of California ** 00007 ** All Rights Reserved. ** 00008 ** ** 00009 ** Commercial use of this program without express permission of the ** 00010 ** University of California, Berkeley, is strictly prohibited. See ** 00011 ** file 'COPYRIGHT' in main directory for information on usage and ** 00012 ** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. ** 00013 ** ** 00014 ** Developed by: ** 00015 ** Frank McKenna (fmckenna@ce.berkeley.edu) ** 00016 ** Gregory L. Fenves (fenves@ce.berkeley.edu) ** 00017 ** Filip C. Filippou (filippou@ce.berkeley.edu) ** 00018 ** ** 00019 ** ****************************************************************** */ 00020 00021 // $Revision: 1.4 $ 00022 // $Date: 2003/02/14 23:01:24 $ 00023 // $Source: /usr/local/cvs/OpenSees/SRC/handler/ErrorHandler.cpp,v $ 00024 00025 00026 // File: ~/handler/ErrorHandler.C 00027 // 00028 // Written: fmk 00029 // Created: 11/99 00030 // Revision: A 00031 // 00032 // Description: This file contains the class implementation for 00033 // ErrorHandler. 00034 // 00035 // What: "@(#) ErrorHandler.C, revA" 00036 00037 #include "ErrorHandler.h" 00038 00039 ErrorHandler::ErrorHandler() 00040 { 00041 00042 } 00043 00044 ErrorHandler::~ErrorHandler() 00045 { 00046 // does nothing 00047 } 00048 00049 void 00050 ErrorHandler::outputMessage(ostream &theStream, const char *msg, va_list args) 00051 { 00052 int dataInt; 00053 double dataDouble; 00054 char *dataString; 00055 char dataChar; 00056 00057 int pos =0; 00058 int done =0; 00059 00060 // parse the msg string until end of string '\0' is 00061 // encounterd, send to the output stream any character, 00062 // if we encounter a %d or a %f get the integer or double 00063 // from the next arg on the va_list and send it to the stream 00064 00065 while (done != 1) { 00066 00067 // if reach string end then we are done 00068 if (msg[pos] == '\0') 00069 break; 00070 00071 // otherwise parse string , looking for special %d and %f 00072 if (msg[pos] != '%') { 00073 dataChar = msg[pos]; 00074 theStream << dataChar; 00075 } else { 00076 pos++; 00077 switch(msg[pos]) { 00078 case 'd': 00079 dataInt = va_arg(args,int); 00080 theStream << dataInt; 00081 break; 00082 00083 case 'f': 00084 dataDouble = va_arg(args,double); 00085 theStream << dataDouble; 00086 break; 00087 00088 case 's': 00089 dataString = va_arg(args,char *); 00090 theStream << dataString; 00091 break; 00092 00093 default: 00094 ; 00095 } 00096 } 00097 pos++; 00098 } 00099 theStream << std::endl; 00100 } |