Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

Error.h

00001 // Error.h: interface for the CError class.
00002 //
00004 
00005 #if !defined(AFX_ERROR_H__004F5B9E_AD82_4BCD_8994_DB97EDEE86A0__INCLUDED_)
00006 #define AFX_ERROR_H__004F5B9E_AD82_4BCD_8994_DB97EDEE86A0__INCLUDED_
00007 
00008 #ifndef SWIG // Remove whatever is not needed by SWIG
00009 
00010 #if _MSC_VER > 1000
00011 #pragma once
00012 #endif // _MSC_VER > 1000
00013 
00014 #include <stdio.h>
00015 
00016 #endif // SWIG
00017 
00033 enum ErrorNumberT {
00034         ERR_NO_ERROR = 0,
00035         ERR_IMAGE_NULL,
00036         ERR_NOT_ENOUGH_MEMORY,
00037         ERR_BAD_PARAMETER_1,
00038         ERR_BAD_PARAMETER_2,
00039         ERR_BAD_PARAMETER_3,
00040         ERR_BAD_PARAMETER_4,
00041         ERR_BAD_PARAMETER_5,
00042         ERR_BAD_PARAMETER_6,
00043         ERR_IMAGES_NOT_SAME_SIZE,
00044         ERR_FILE_NOT_EXIST,
00045         ERR_FILE_NOT_READABLE,
00046         ERR_FILE_NOT_WRITEABLE,
00047         ERR_FILE_NOT_CORRECT
00048 };
00049 
00050 static char * ErrorMessage[] = {
00051         "No error",
00052         "Image is a null pointer",
00053         "Not enough memory for allocation",
00054         "Parameter 1 is not correct",
00055         "Parameter 2 is not correct",
00056         "Images are not of the same size",
00057         "File does not exist",
00058         "File is not readable",
00059         "File is not writeable",
00060         "File is not correct"
00061 };
00062 
00063 
00064 class CError  
00065 {
00066         static ErrorNumberT ErrorNumber;
00067 
00068 protected:
00070         inline void ErrorSet(int error) {ErrorNumber = ErrorNumberT(error); };
00072         inline void ErrorInit(void) {ErrorNumber = ERR_NO_ERROR; };
00073 
00074 public:
00075         CError();
00076         virtual ~CError();
00077 
00079         inline void ErrorClean(void) {ErrorSet(0); }
00080 
00082         inline int ErrorGet(void) const {return ErrorNumber; };
00083         
00085         inline const char * ErrorMessageGet(const char * message) {
00086                 static char buf[512];
00087                 sprintf(buf, "Error: %s; %s", ErrorMessage[ErrorNumber], message);
00088                 return buf;
00089         };
00090         
00091 };
00092 
00093 #endif // !defined(AFX_ERROR_H__004F5B9E_AD82_4BCD_8994_DB97EDEE86A0__INCLUDED_)

Generated at Sun May 12 19:04:22 2002 for OpenMorpho by doxygen1.2.0 written by Dimitri van Heesch, © 1997-2000