zdict.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #include <contrib/libs/zstd06/renames.h>
  2. /*
  3. dictBuilder header file
  4. Copyright (C) Yann Collet 2016
  5. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
  6. Redistribution and use in source and binary forms, with or without
  7. modification, are permitted provided that the following conditions are
  8. met:
  9. * Redistributions of source code must retain the above copyright
  10. notice, this list of conditions and the following disclaimer.
  11. * Redistributions in binary form must reproduce the above
  12. copyright notice, this list of conditions and the following disclaimer
  13. in the documentation and/or other materials provided with the
  14. distribution.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  16. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  17. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  18. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  19. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  20. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  21. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  22. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  23. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  25. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. You can contact the author at :
  27. - Zstd source repository : https://www.zstd.net
  28. */
  29. #ifndef DICTBUILDER_H_001
  30. #define DICTBUILDER_H_001
  31. #if defined (__cplusplus)
  32. extern "C" {
  33. #endif
  34. /*-*************************************
  35. * Public functions
  36. ***************************************/
  37. /*! ZDICT_trainFromBuffer() :
  38. Train a dictionary from a memory buffer `samplesBuffer`,
  39. where `nbSamples` samples have been stored concatenated.
  40. Each sample size is provided into an orderly table `samplesSizes`.
  41. Resulting dictionary will be saved into `dictBuffer`.
  42. @return : size of dictionary stored into `dictBuffer` (<= `dictBufferCapacity`)
  43. or an error code, which can be tested by ZDICT_isError().
  44. */
  45. size_t ZDICT_trainFromBuffer(void* dictBuffer, size_t dictBufferCapacity,
  46. const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples);
  47. /*-*************************************
  48. * Helper functions
  49. ***************************************/
  50. unsigned ZDICT_isError(size_t errorCode);
  51. const char* ZDICT_getErrorName(size_t errorCode);
  52. #if defined (__cplusplus)
  53. }
  54. #endif
  55. #endif