thcompressutil.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef _thcompressutil_ipp
  14. #define _thcompressutil_ipp
  15. #include "jlib.hpp"
  16. #include "jbuff.hpp"
  17. #ifdef _WIN32
  18. #ifdef GRAPH_EXPORTS
  19. #define graph_decl __declspec(dllexport)
  20. #else
  21. #define graph_decl __declspec(dllimport)
  22. #endif
  23. #else
  24. #define graph_decl
  25. #endif
  26. /*
  27. Note: The first sizeof(size32_t) bytes of the compressed buffer contain the
  28. original (uncompressed) size of the data or 0. If 0, it indicates that
  29. buffer is uncompressed - this happens if the data could not be compressed
  30. by a minimum of 80%.
  31. */
  32. extern graph_decl size32_t ThorCompress(const void * src, size32_t srcSz, void * dest, size32_t destSz, size32_t threshold=0x1000);
  33. extern graph_decl size32_t ThorCompress(const void * src, size32_t srcSz, MemoryBuffer & dest, size32_t threshold=0x1000);
  34. extern graph_decl size32_t ThorCompress(MemoryBuffer & src, MemoryBuffer & dest, size32_t threshold=0x1000);
  35. extern graph_decl size32_t ThorExpand(const void * src, size32_t srcSz, void * dest, size32_t destSz);
  36. extern graph_decl size32_t ThorExpand(const void * src, size32_t srcSz, MemoryBuffer & dest);
  37. extern graph_decl size32_t ThorExpand(MemoryBuffer & src, MemoryBuffer & dest);
  38. extern graph_decl size32_t ThorExpand(const void * src, size32_t srcSz, CLargeMemoryAllocator &mem);
  39. #endif