00001 /** @file psErrorCodes.h 00002 * 00003 * @brief Contains the error codes for the error classes 00004 * 00005 * @ingroup ErrorHandling 00006 * 00007 * @author Robert DeSonia, MHPCC 00008 * 00009 * @version $Revision: 1.1.1.1 $ $Name: $ 00010 * @date $Date: 2005/06/15 21:08:12 $ 00011 * 00012 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 00013 */ 00014 00015 #ifndef PS_ERROR_CODES_H 00016 #define PS_ERROR_CODES_H 00017 00018 #include "psType.h" 00019 00020 /* N.B., lines between '//~Start' and '//~End' are automatic generated from 00021 * the template following the '//~Start'. The template is used to generate 00022 * the other lines by, for each error class in psErrorCodes.dat, the following 00023 * substitutions are made: 00024 * $1 The error code name (first word in the psErrorCodes.dat lines) 00025 * $2 The error description (rest of the line in psErrorCodes.dat) 00026 * $n The order of the source line in psErrorCodes.dat (comments excluded) 00027 * 00028 * DO NOT EDIT THE LINES BETWEEN //~Start and //~End! ANY CHANGES WILL BE OVERWRITTEN. 00029 */ 00030 00031 /** @addtogroup ErrorHandling 00032 * @{ 00033 */ 00034 00035 /** enumeration of the static error code classes 00036 */ 00037 typedef enum { 00038 PS_ERR_NONE = 0, ///< not an error 00039 PS_ERR_BASE = 256, 00040 /**< base error. Any psErrorCode less than this should be taken to be 00041 * valid values of errno 00042 */ 00043 00044 //~Start PS_ERR_$1, ///< $2 00045 PS_ERR_UNKNOWN, ///< unknown error 00046 PS_ERR_IO, ///< I/O error 00047 PS_ERR_LOCATION_INVALID, ///< specified location is unknown 00048 PS_ERR_MEMORY_CORRUPTION, ///< memory corruption detected 00049 PS_ERR_MEMORY_DEREF_USAGE, ///< dereferenced memory still used 00050 PS_ERR_BAD_PARAMETER_VALUE, ///< parameter is out-of-range 00051 PS_ERR_BAD_PARAMETER_TYPE, ///< parameter is of unsupported type 00052 PS_ERR_BAD_PARAMETER_NULL, ///< parameter is null 00053 PS_ERR_BAD_PARAMETER_SIZE, ///< size of parameter's data is outside of acceptable range. 00054 PS_ERR_UNEXPECTED_NULL, ///< unexpected NULL found 00055 PS_ERR_OS_CALL_FAILED, ///< unexpected result from an OS standard library call 00056 //~End 00057 PS_ERR_N_ERR_CLASSES ///< end marker - should not be used as a true error 00058 } psErrorCode; 00059 00060 /** An error code with description 00061 */ 00062 typedef struct 00063 { 00064 psErrorCode code; ///< An error code 00065 const char *description; ///< the associated description 00066 } 00067 psErrorDescription; 00068 00069 /** Allocates a new psErrorDescription 00070 * 00071 * @return psErrorDescription* new psErrorDescription struct. 00072 */ 00073 psErrorDescription* psErrorDescriptionAlloc( 00074 psErrorCode code, ///< An error code 00075 const char *description ///< the associated description 00076 ); 00077 00078 /** Retrieves the description of an error code. 00079 * 00080 * The routine psErrorCodeString returns the string associated with an error 00081 * code. 00082 * 00083 * @return const char* the description associated with the given code. 00084 */ 00085 const char *psErrorCodeString( 00086 psErrorCode code ///< the associated error code 00087 ); 00088 00089 /** Register an error code 00090 * 00091 * Any project needed to use psLib must define the necessary error codes and 00092 * associated message strings. This function registers an array of error 00093 * codes with the error handling subsystem. 00094 * 00095 */ 00096 void psErrorRegister( 00097 const psErrorDescription* errors, ///< Array of error codes to register 00098 psS32 nerror ///< number of errors in input array 00099 ); 00100 00101 /** Clears error codes registered via psErrorRegister. 00102 * 00103 * @return psBool TRUE if given errorcode was removed, otherwise FALSE. 00104 */ 00105 psBool p_psErrorUnregister( 00106 psErrorCode code ///< the error code to find and remove 00107 ); 00108 00109 /// @} 00110 00111 #endif // #ifndef PS_ERROR_CODES_H
1.4.1