Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's 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 using std::exception;
00046 
00047 class HxException : public exception, public BaseClass, public CounterConstDestr<HxException>
00048 {
00049 public:
00050     HxException();
00051     HxException(const std::string& msg, const char *file, 
00052         const int line, const int ErrCode = HX_EXC_INTERNAL_ERROR);
00053     HxException(const HxException& Exc);
00054     HxException(const exception& Exc);
00055     HxException& operator=(const HxException& Exc);
00056 
00057     virtual ~HxException() throw();
00058     virtual const char* what() const throw();
00059     
00060 private:
00061     std::string Str;
00062     int ErrCode;
00063 
00064     friend HxException AddMess(const exception& Exc, const std::string& msg);
00065     friend HxException AddMess(const exception& Exc, 
00066         const std::string& filename, const int line);
00067 
00068     
00069 };
00070 
00071 
00072 #endif
00073 

Generated on Tue Feb 3 14:18:33 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001