RoadError.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (c) 2008-2011 C.B. Barber. All rights reserved.
00004 ** $Id: //main/2011/qhull/src/road/RoadError.h#4 $$Change: 1342 $
00005 ** $DateTime: 2011/03/07 21:55:47 $$Author: bbarber $
00006 **
00007 ****************************************************************************/
00008 
00009 #ifndef ROADERROR_H
00010 #define ROADERROR_H
00011 
00012 #include "RoadLogEvent.h"
00013 
00014 #include <iostream>
00015 #include <sstream>
00016 #include <stdexcept>
00017 #include <string>
00018 
00019 using std::endl;
00020 
00021 namespace orgQhull {
00022 
00023 #//Types
00024 
00025 
00026 
00027     class RoadError;
00028 
00029 class RoadError : public std::exception {
00030 
00031 private:
00032 #//Fields
00033     int                 error_code;  
00034     RoadLogEvent        log_event;   
00035     mutable std::string error_message;  
00036 
00037 #//Class fields
00038     static const char  *  ROADtag;
00039     static std::ostringstream  global_log; 
00040 
00041 public:
00042 #//Constants
00043 
00044 #//Constructors
00045     RoadError();
00046     RoadError(const RoadError &other);  
00047     RoadError(int code, const std::string &message);
00048     RoadError(int code, const char *fmt);
00049     RoadError(int code, const char *fmt, int d);
00050     RoadError(int code, const char *fmt, int d, int d2);
00051     RoadError(int code, const char *fmt, int d, int d2, float f);
00052     RoadError(int code, const char *fmt, int d, int d2, float f, const char *s);
00053     RoadError(int code, const char *fmt, int d, int d2, float f, const void *x);
00054     RoadError(int code, const char *fmt, int d, int d2, float f, int i);
00055     RoadError(int code, const char *fmt, int d, int d2, float f, long long i);
00056     RoadError(int code, const char *fmt, int d, int d2, float f, double e);
00057 
00058     RoadError          &operator=(const RoadError &other);
00059                        ~RoadError() throw() {};
00060 
00061 #//Class methods
00062 
00063     static void         clearGlobalLog() { global_log.seekp(0); }
00064     static bool         emptyGlobalLog() { return global_log.tellp()<=0; }
00065     static const char  *stringGlobalLog() { return global_log.str().c_str(); }
00066 
00067 #//Virtual
00068     virtual const char *what() const throw();
00069 
00070 #//GetSet
00071     bool                isDefined() const { return log_event.isDefined(); }
00072     int                 errorCode() const { return error_code; };
00073    // FIXUP QH11021 should RoadError provide errorMessage().  Currently what()
00074     RoadLogEvent        roadLogEvent() const { return log_event; };
00075 
00076 #//Update
00077     void                logError() const;
00078 };//class RoadError
00079 
00080 }//namespace orgQhull
00081 
00082 #//Global functions
00083 
00084 inline std::ostream    &operator<<(std::ostream &os, const orgQhull::RoadError &e) { return os << e.what(); }
00085 
00086 #endif // ROADERROR_H


libqhull-ours
Author(s): Robert Krug
autogenerated on Mon Jan 6 2014 11:32:11