libcm is a C development framework with an emphasis on audio signal processing applications.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

cmErr.h 3.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //( { file_desc:"Format error messages and track the last error generated." kw:[base]}
  2. //
  3. // This class is used to format error messages and track the last error generated.
  4. //
  5. // Most of the cmHandle_t based classes use cmErr_t to format error messages with a
  6. // title, maintain the last result code which indicated an error, and to hold
  7. // a cmRpt_t object to manage application supplied text printing callbacks.
  8. //
  9. //)
  10. //
  11. #ifndef cmErr_h
  12. #define cmErr_h
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. //(
  17. typedef struct
  18. {
  19. cmRpt_t* rpt; //< Pointer to a cmRpt_t object which is used to direct error messages to an application supplied console.
  20. const cmChar_t* label; //< This field contains a pointer to a text label used to form the error message title.
  21. cmRC_t rc; //< This is the last result code passed via one of the cmErrXXXMsg() functions.
  22. cmRC_t warnRC; //< Last warning RC
  23. } cmErr_t;
  24. // Setup a cmErr_t record.
  25. //
  26. // Note that rpt and staticLabelStr must point to client supplied objects
  27. // whose lifetime is at least that of this cmErr_t object.
  28. void cmErrSetup( cmErr_t* err, cmRpt_t* rpt, const cmChar_t* staticLabelStr );
  29. // Duplicate a cmErr_t record.
  30. void cmErrClone( cmErr_t* dstErr, const cmErr_t* srcErr );
  31. // Error Reporting functions:
  32. // Functions to signal an error. The rc argument is generally specific to the
  33. // client class using the error. See the kXXXRC enumerations in the handle based
  34. // classes for examples of result codes.
  35. cmRC_t cmErrMsg( cmErr_t* err, cmRC_t rc, const cmChar_t* fmt, ... );
  36. cmRC_t cmErrVMsg(cmErr_t* err, cmRC_t rc, const cmChar_t* fmt, va_list vl );
  37. // Report Errors which contain accompanying system error codes.
  38. // Use these functions when a system error (e.g. Unix errno) gives additional information
  39. // about the source of the error.
  40. cmRC_t cmErrSysMsg( cmErr_t* err, cmRC_t rc, cmSysErrCode_t sysErrCode, const cmChar_t* fmt, ... );
  41. cmRC_t cmErrVSysMsg(cmErr_t* err, cmRC_t rc, cmSysErrCode_t sysErrCode, const cmChar_t* fmt, va_list vl );
  42. // Warning Reporting functions:
  43. // Errors generally result in a task aborting. Warnings are informative but the task is
  44. // expected to continue.
  45. // Functions to signal a warning. The rc argument is generally specific to the
  46. // client class using the error. See the kXXXRC enumerations in the handle based
  47. // classes for examples of result codes.
  48. cmRC_t cmErrWarnMsg( cmErr_t* err, cmRC_t rc, const cmChar_t* fmt, ... );
  49. cmRC_t cmErrWarnVMsg(cmErr_t* err, cmRC_t rc, const cmChar_t* fmt, va_list vl );
  50. // Report warnings which contain accompanying system error codes.
  51. // Use these functions when a system error (e.g. Unix errno) gives additional information
  52. // about the source of the error.
  53. cmRC_t cmErrWarnSysMsg( cmErr_t* err, cmRC_t rc, cmSysErrCode_t sysErrCode, const cmChar_t* fmt, ... );
  54. cmRC_t cmErrWarnVSysMsg(cmErr_t* err, cmRC_t rc, cmSysErrCode_t sysErrCode, const cmChar_t* fmt, va_list vl );
  55. // Return the last recorded RC.
  56. cmRC_t cmErrLastRC( cmErr_t* err );
  57. // Return the last recorded RC and set it to a new value.
  58. cmRC_t cmErrSetRC( cmErr_t* err, cmRC_t rc );
  59. // Return the last recorded RC and set it to cmOkRC.
  60. cmRC_t cmErrClearRC( cmErr_t* err );
  61. //)
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif