Main Page   Class Overview   Pixels   Images   Geometry   Quick Index  

HxException.h

00001 /*
00002  *  HxException
00003  *
00004  *  Copyright (c) 2000, TNO TPD, The Netherlands.
00005  *  All rights reserved. No part of this software may be handed to or used by persons 
00006  *  or organisation outside Kenniscentrum Watergraafsmeer (UvA-ISIS, TNO TPD) without 
00007  *  the written permission of TNO TPD.
00008  *
00009  *  Author(s):
00010  *      Jan Baan (baan@tpd.tno.nl)
00011  *
00012  */
00013 
00014 
00015 
00016 #ifndef HxException_h
00017 #define HxException_h
00018 
00019 #define HX_EXC_INTERNAL_ERROR  (-1001)
00020 #define HX_EXC_FILE_IO (-1002)
00021 
00022 #include "exception"
00023 #include "string"
00024 #include "BaseClass.h"
00025 #include "CounterConstDestr.h"
00026 
00027 #ifdef HXTRYCATCH
00028     #define HXCATCH  catch(exception& E) { \
00029             throw AddMess(E,__FILE__,__LINE__); \
00030         } catch(...) { \
00031             throw HxException(" ",__FILE__,__LINE__); \
00032         }
00033     #define HXCATCHPRINT catch(exception& E) { \
00034             std::cerr << E.what() << std::endl; \
00035         } catch(...) { \
00036             std::cerr << "Exit by unknown Exception." << std::endl; \
00037         }
00038     #define HXTRY try
00039 #else
00040     #define HXCATCH
00041     #define HXCATCHPRINT
00042     #define HXTRY
00043 #endif
00044 
00045 class HxException : public exception, public BaseClass, public CounterConstDestr<HxException>
00046 {
00047 public:
00048     HxException();
00049     HxException(const std::string& msg, const char *file, 
00050         const int line, const int ErrCode = HX_EXC_INTERNAL_ERROR);
00051     HxException(const HxException& Exc);
00052     HxException(const exception& Exc);
00053     HxException& operator=(const HxException& Exc);
00054 
00055     ~HxException();
00056     virtual const char* what() const;
00057     
00058 private:
00059     std::string Str;
00060     int ErrCode;
00061 
00062     friend HxException AddMess(const exception& Exc, const std::string& msg);
00063     friend HxException AddMess(const exception& Exc, 
00064         const std::string& filename, const int line);
00065 
00066     
00067 };
00068 
00069 
00070 #endif
00071 

Generated on Tue Jan 8 13:59:12 2002 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001