00001 /** @file psErrorCodes.h 00002 * 00003 * @brief Contains the error codes for the error classes 00004 * 00005 * @author RHL, Princeton 00006 * @author Robert DeSonia, MHPCC 00007 * 00008 * @version $Revision: 1.4 $ $Name: $ 00009 * @date $Date: 2007/01/23 22:47:23 $ 00010 * 00011 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 00012 */ 00013 00014 #ifndef PS_ERROR_CODES_H 00015 #define PS_ERROR_CODES_H 00016 00017 /// @addtogroup SysUtils System Utilities 00018 /// @{ 00019 00020 #include "psType.h" 00021 00022 /** enumeration of the static error code classes 00023 */ 00024 typedef enum { 00025 PS_ERR_NONE = 0, ///< not an error 00026 PS_ERR_BASE = 256, 00027 /**< base error. Any psErrorCode less than this should be taken to be 00028 * valid values of errno 00029 */ 00030 PS_ERR_UNKNOWN, 00031 PS_ERR_IO, 00032 PS_ERR_LOCATION_INVALID, 00033 PS_ERR_MEMORY_CORRUPTION, 00034 PS_ERR_MEMORY_DEREF_USAGE, 00035 PS_ERR_BAD_PARAMETER_VALUE, 00036 PS_ERR_BAD_PARAMETER_TYPE, 00037 PS_ERR_BAD_PARAMETER_NULL, 00038 PS_ERR_BAD_PARAMETER_SIZE, 00039 PS_ERR_UNEXPECTED_NULL, 00040 PS_ERR_OS_CALL_FAILED, 00041 PS_ERR_BAD_FITS, 00042 PS_ERR_IEEE, 00043 PS_ERR_DB_CLIENT, 00044 PS_ERR_DB_SERVER, 00045 PS_ERR_N_ERR_CLASSES ///< end marker - should not be used as a true error 00046 } psErrorCode; 00047 00048 /** An error code with description 00049 */ 00050 typedef struct 00051 { 00052 psErrorCode code; ///< An error code 00053 const char *description; ///< the associated description 00054 } 00055 psErrorDescription; 00056 00057 /** Allocates a new psErrorDescription 00058 * 00059 * @return psErrorDescription* new psErrorDescription struct. 00060 */ 00061 psErrorDescription* psErrorDescriptionAlloc( 00062 psErrorCode code, ///< An error code 00063 const char *description ///< the associated description 00064 ); 00065 00066 /** Retrieves the description of an error code. 00067 * 00068 * The routine psErrorCodeString returns the string associated with an error 00069 * code. 00070 * 00071 * @return const char* the description associated with the given code. 00072 */ 00073 const char *psErrorCodeString( 00074 psErrorCode code ///< the associated error code 00075 ); 00076 00077 /** Register an error code 00078 * 00079 * Any project needed to use psLib must define the necessary error codes and 00080 * associated message strings. This function registers an array of error 00081 * codes with the error handling subsystem. 00082 * 00083 */ 00084 void psErrorRegister( 00085 const psErrorDescription* errors, ///< Array of error codes to register 00086 int errorCode ///< number of errors in input array 00087 ); 00088 00089 /** Clears error codes registered via psErrorRegister. 00090 * 00091 * @return psBool TRUE if given errorcode was removed, otherwise FALSE. 00092 */ 00093 psBool p_psErrorUnregister( 00094 psErrorCode code ///< the error code to find and remove 00095 ); 00096 00097 /// @} 00098 #endif // #ifndef PS_ERROR_CODES_H
1.5.1