libcm is a C development framework with an emphasis on audio signal processing applications.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cmCtx.h 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //| Copyright: (C) 2009-2020 Kevin Larke <contact AT larke DOT org>
  2. //| License: GNU GPL version 3.0 or above. See the accompanying LICENSE file.
  3. //( { file_desc:"Global application context record." kw[base] }
  4. //
  5. // cmCtx_t is used to hold application supplied cmRpt_t, cmErr_t and
  6. // other global values for easy distribution throughtout a cm based application.
  7. //
  8. // Most the libcm components need at least an application supplied cmRpt_t function
  9. // to initialize their own internal cmErr_t error class. Likewise classes which
  10. // use a cmLHeapH_t based internal heap manager require application wide memory
  11. // manager configuration information. The cmCtx_t packages this information and
  12. // allows it to be easily distributed. The applicaton and its constituent objects
  13. // then need only maintain and pass pointers to a single cmCtx_t object to have access to
  14. // all the global program information.
  15. //)
  16. #ifndef cmCtx_h
  17. #define cmCtx_h
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. //(
  22. // cmCtx_t data type.
  23. typedef struct
  24. {
  25. cmRpt_t rpt; // Application supplied global reporter. This reporter is also use by \ref err.
  26. cmErr_t err; // Application error reporter which can be used to report errors prior to the client object being initialized to the point where it can use it's own cmErr_t.
  27. unsigned guardByteCnt; // Guard byte count in use by \ref cmMallocDebug.h .
  28. unsigned alignByteCnt; // Align byte count used by the \ref cmMallocDebug.h
  29. unsigned mmFlags; // Initialization flags used by \ref cmMallocDebug.h.
  30. void* userDefPtr; // Application defined pointer.
  31. } cmCtx_t;
  32. // cmCtx_t initialization function.
  33. void cmCtxSetup(
  34. cmCtx_t* ctx, // The cmCtx_t to initialize.
  35. const cmChar_t* title, // The cmCtx_t error label. See cmErrSetup().
  36. cmRptPrintFunc_t prtFunc, // The printFunc() to assign to the cmCtx_t.rpt.
  37. cmRptPrintFunc_t errFunc, // The errFunc() to assign to cmCtx_t.rpt.
  38. void* cbPtr, // Callback data to use with prtFunc() and errFunc().
  39. unsigned guardByteCnt,// Guard byte count used to configure \ref cmMallocDebug.h
  40. unsigned alignByteCnt,// Align byte count used to configure \ref cmMallocDebug.h
  41. unsigned mmFlags // Initialization flags used to configure \ref cmMallocDebug.h
  42. );
  43. //)
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #endif