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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef cmDList_h
  2. #define cmDList_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. enum
  7. {
  8. kOkDlRC = cmOkRC,
  9. kDuplicateIndexIdDlRC,
  10. kInvalidIndexDlRC,
  11. kIterNotFoundDlRC,
  12. kDataRecdNotFoundDlRC,
  13. };
  14. typedef unsigned cmDlRC_t;
  15. typedef cmHandle_t cmDListH_t;
  16. typedef cmHandle_t cmDListIterH_t;
  17. extern cmDListH_t cmDListNullHandle;
  18. extern cmDListIterH_t cmDListIterNullHandle;
  19. // Return < 0 if v0 < v1
  20. // == 0 if v0 == v1
  21. // > 0 if v0 > v1
  22. typedef int (*cmDListCmpFunc_t)( void* arg, const void* v0, unsigned v0N, const void* v1, unsigned v1N );
  23. typedef void (*cmDListIndexFreeFunc_t)( unsigned indexId, void* arg );
  24. // If 'f' is not NULL then a default index with an indexId==0 will be automatically created.
  25. cmDlRC_t cmDListAlloc( cmCtx_t* ctx, cmDListH_t* hp, cmDListCmpFunc_t f, void* farg );
  26. cmDlRC_t cmDListFree( cmDListH_t* hp );
  27. bool cmDListIsValid( cmDListH_t h );
  28. cmDlRC_t cmDListInsert( cmDListH_t h, const void* recd, unsigned recdByteN );
  29. cmDlRC_t cmDListDelete( cmDListH_t h, const void* recd );
  30. cmDlRC_t cmDListIndexAlloc( cmDListH_t h, unsigned indexId, cmDListCmpFunc_t f, void* farg );
  31. cmDlRC_t cmDListIndexFree( cmDListH_t h, unsigned indexId );
  32. cmDlRC_t cmDListIndexSetFreeFunc(cmDListH_t h, unsigned indexId, cmDListIndexFreeFunc_t func );
  33. cmDlRC_t cmDListIterAlloc( cmDListH_t h, cmDListIterH_t* iHp, unsigned indexId );
  34. cmDlRC_t cmDListIterFree( cmDListIterH_t* iHp );
  35. bool cmDListIterIsValid( cmDListIterH_t iH );
  36. cmDlRC_t cmDListIterSeekBegin( cmDListIterH_t iH );
  37. cmDlRC_t cmDListIterSeekEnd( cmDListIterH_t iH );
  38. const void* cmDListIterGet( cmDListIterH_t iH, unsigned* recdByteNRef );
  39. const void* cmDListIterPrev( cmDListIterH_t iH, unsigned* recdByteNRef );
  40. const void* cmDListIterNext( cmDListIterH_t iH, unsigned* recdByteNRef );
  41. const void* cmDListIterFind( cmDListIterH_t iH, const void* key, unsigned keyN, unsigned* recdByteNRef);
  42. #ifdef __cplusplus
  43. }
  44. #endif
  45. #endif